Github user kiszk commented on a diff in the pull request:
https://github.com/apache/spark/pull/19998#discussion_r157333050
--- Diff: dev/run-tests.py ---
@@ -253,9 +253,11 @@ 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)
+ cmd = "%s -P |grep %s | grep LISTEN | awk '{ print $2; }' | xargs kill"
+ try:
+ subprocess.check_call(cmd % ("lsof", zinc_port), shell=True)
+ except:
+ subprocess.call(cmd % ("/usr/sbin/lsof", zinc_port), shell=True)
--- End diff --
I intentionally use `subprocess.call` to continue the execution even if
`lsof` and `/usr/sbin/lsof` do not exist. This is because it is ok for other
steps if we fail to kill `zinc`.
WDYT?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]