From 969bc227f255d721044e057da633c5f2becca2af Mon Sep 17 00:00:00 2001 From: Kazuaki Ishizaki Date: Sat, 16 Dec 2017 11:14:14 +0900 Subject: [PATCH 1/4] initial commit --- dev/run-tests.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/dev/run-tests.py b/dev/run-tests.py index ef0e788a91606..b11b83d5d20fb 100755 --- a/dev/run-tests.py +++ b/dev/run-tests.py @@ -253,9 +253,14 @@ def kill_zinc_on_port(zinc_port): """ Kill the Zinc process running on the given port, if one exists. """ - cmd = ("/usr/sbin/lsof -P |grep %s | grep LISTEN " - "| awk '{ print $2; }' | xargs kill") % zinc_port - subprocess.check_call(cmd, shell=True) + try: + cmd = ("lsof -P |grep %s | grep LISTEN " + "| awk '{ print $2; }' | xargs kill") % zinc_port + subprocess.check_call(cmd, shell=True) + except: + cmd = ("/usr/sbin/lsof -P |grep %s | grep LISTEN " + "| awk '{ print $2; }' | xargs kill") % zinc_port + subprocess.call(cmd, shell=True) def exec_maven(mvn_args=()): From b384336d9b71b992ce6478b56378b7b1cabdbd3c Mon Sep 17 00:00:00 2001 From: Kazuaki Ishizaki Date: Sat, 16 Dec 2017 12:24:07 +0900 Subject: [PATCH 2/4] address review comment --- dev/run-tests.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/dev/run-tests.py b/dev/run-tests.py index b11b83d5d20fb..f0e42ef4d2b3f 100755 --- a/dev/run-tests.py +++ b/dev/run-tests.py @@ -253,14 +253,11 @@ def kill_zinc_on_port(zinc_port): """ Kill the Zinc process running on the given port, if one exists. """ + cmd = "%s -P |grep %s | grep LISTEN | awk '{ print $2; }' | xargs kill" try: - cmd = ("lsof -P |grep %s | grep LISTEN " - "| awk '{ print $2; }' | xargs kill") % zinc_port - subprocess.check_call(cmd, shell=True) + subprocess.check_call(cmd % ("lsof", zinc_port), shell=True) except: - cmd = ("/usr/sbin/lsof -P |grep %s | grep LISTEN " - "| awk '{ print $2; }' | xargs kill") % zinc_port - subprocess.call(cmd, shell=True) + subprocess.call(cmd % ("/usr/sbin/lsof", zinc_port), shell=True) def exec_maven(mvn_args=()): From 964e5ff22cefe336cd47d3a9309a8d1428b476b6 Mon Sep 17 00:00:00 2001 From: Kazuaki Ishizaki Date: Sat, 16 Dec 2017 12:51:47 +0900 Subject: [PATCH 3/4] address review comment --- dev/run-tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/run-tests.py b/dev/run-tests.py index f0e42ef4d2b3f..36c0c6ace962c 100755 --- a/dev/run-tests.py +++ b/dev/run-tests.py @@ -257,7 +257,7 @@ def kill_zinc_on_port(zinc_port): try: subprocess.check_call(cmd % ("lsof", zinc_port), shell=True) except: - subprocess.call(cmd % ("/usr/sbin/lsof", zinc_port), shell=True) + subprocess.check_call(cmd % ("/usr/sbin/lsof", zinc_port), shell=True) def exec_maven(mvn_args=()): From 6c29a11e6f08a83cd10eaeda3240b49f15aea07b Mon Sep 17 00:00:00 2001 From: Kazuaki Ishizaki Date: Sat, 16 Dec 2017 14:41:18 +0900 Subject: [PATCH 4/4] address review comment --- dev/run-tests.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/dev/run-tests.py b/dev/run-tests.py index 36c0c6ace962c..7e6f7ff060351 100755 --- a/dev/run-tests.py +++ b/dev/run-tests.py @@ -254,10 +254,8 @@ def kill_zinc_on_port(zinc_port): Kill the Zinc process running on the given port, if one exists. """ cmd = "%s -P |grep %s | grep LISTEN | awk '{ print $2; }' | xargs kill" - try: - subprocess.check_call(cmd % ("lsof", zinc_port), shell=True) - except: - subprocess.check_call(cmd % ("/usr/sbin/lsof", zinc_port), shell=True) + lsof_exe = which("lsof") + subprocess.check_call(cmd % (lsof_exe if lsof_exe else "/usr/sbin/lsof", zinc_port), shell=True) def exec_maven(mvn_args=()):