mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 07:17:55 +03:00
run-tests: explicitly close fds when spwaning watchman
Summary: Previously, the watchman forground server could inherit other fds (ex. the one that waits for "watchman --version --no-spawn" output) and cause the read of "watchman --version" to take forever. This patch closes related fds to solve the issue. Reviewed By: wez Differential Revision: D8846430 fbshipit-source-id: d65f3377ac3b2277d1be7149a4ceb590f9a184a2
This commit is contained in:
parent
4ce060d4c7
commit
a5dfe6b736
@ -1004,8 +1004,10 @@ class Test(unittest.TestCase):
|
||||
|
||||
if os.name == "nt":
|
||||
sockfile = "\\\\.\\pipe\\watchman-test-%s" % uuid.uuid4().hex
|
||||
closefd = False
|
||||
else:
|
||||
sockfile = os.path.join(self._watchmandir, b"sock")
|
||||
closefd = True
|
||||
|
||||
self._watchmansock = sockfile
|
||||
|
||||
@ -1037,7 +1039,7 @@ class Test(unittest.TestCase):
|
||||
|
||||
with open(clilogfile, "wb") as f:
|
||||
self._watchmanproc = subprocess.Popen(
|
||||
argv, env=envb, stdin=None, stdout=f, stderr=f
|
||||
argv, env=envb, stdin=None, stdout=f, stderr=f, close_fds=closefd
|
||||
)
|
||||
|
||||
# Wait for watchman socket to become available
|
||||
@ -1055,7 +1057,7 @@ class Test(unittest.TestCase):
|
||||
try:
|
||||
# The watchman CLI can wait for a short time if sockfile
|
||||
# is not ready.
|
||||
subprocess.check_output(argv, env=envb)
|
||||
subprocess.check_output(argv, env=envb, close_fds=closefd)
|
||||
watchmanavailable = True
|
||||
except Exception:
|
||||
time.sleep(0.1)
|
||||
|
Loading…
Reference in New Issue
Block a user