From 041af47977925c319ad3b6a809089eb64ffdd738 Mon Sep 17 00:00:00 2001 From: Tom Clegg Date: Thu, 16 Jul 2015 14:33:43 -0400 Subject: [PATCH 1/1] 5898: Use lsof instead of fuser -- fuser 1234/tcp just hangs on some systems. --- sdk/python/tests/run_test_server.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sdk/python/tests/run_test_server.py b/sdk/python/tests/run_test_server.py index 31493cc10a..1c5162b97d 100644 --- a/sdk/python/tests/run_test_server.py +++ b/sdk/python/tests/run_test_server.py @@ -122,16 +122,17 @@ def _wait_until_port_listens(port, timeout=10): in seconds), print a warning on stderr before returning. """ try: - subprocess.check_output(['fuser', '-l']) + subprocess.check_output(['which', 'lsof']) except subprocess.CalledProcessError: - print("WARNING: No `fuser` -- cannot wait for port to listen. "+ + print("WARNING: No `lsof` -- cannot wait for port to listen. "+ "Sleeping 0.5 and hoping for the best.") time.sleep(0.5) return deadline = time.time() + timeout while time.time() < deadline: try: - fuser_says = subprocess.check_output(['fuser', str(port)+'/tcp']) + subprocess.check_output( + ['lsof', '-t', '-i', 'tcp:'+str(port)]) except subprocess.CalledProcessError: time.sleep(0.1) continue -- 2.30.2