You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
580 B
26 lines
580 B
#!/usr/bin/env python2.7
|
|
|
|
# Copyright (c) Facebook, Inc. and its affiliates.
|
|
#
|
|
# This source code is licensed under the MIT license found in the
|
|
# LICENSE file in the root directory of this source tree.
|
|
|
|
import os
|
|
import sys
|
|
import fcntl
|
|
import subprocess
|
|
|
|
TESTS_DIR = os.path.dirname(os.path.realpath(__file__))
|
|
LOCKFILE = os.path.join(TESTS_DIR, 'testlock.mutex')
|
|
|
|
args = sys.argv[1:]
|
|
|
|
with open(LOCKFILE, 'r') as lockfile:
|
|
fd = lockfile.fileno()
|
|
|
|
fcntl.flock(fd, fcntl.LOCK_EX)
|
|
try:
|
|
subprocess.call(args)
|
|
finally:
|
|
fcntl.flock(fd, fcntl.LOCK_UN)
|