Reviewed By: jvillard Differential Revision: D15555573 fbshipit-source-id: 40a9a0e31master
parent
9b8a908ad3
commit
88d31a7a21
@ -0,0 +1,25 @@
|
|||||||
|
#!/usr/bin/env python2.7
|
||||||
|
|
||||||
|
# Copyright (c) 2019-present, Facebook, Inc.
|
||||||
|
#
|
||||||
|
# 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)
|
Loading…
Reference in new issue