Github user HyukjinKwon commented on a diff in the pull request:
https://github.com/apache/spark/pull/19998#discussion_r157331922
--- Diff: 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:
--- End diff --
Could we catch the explicit exception?
Also, I think we could this like:
```python
cmd = "%s -P |grep %s | grep LISTEN | awk '{ print $2; }' | xargs kill"
...
lsof = "lsof"
subprocess.check_call(cmd % (lsof zinc_port), shell=True)
...
lsof = "/usr/sbin/lsof"
subprocess.check_call(cmd % (lsof zinc_port), shell=True)
```
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]