aboutsummaryrefslogtreecommitdiff
path: root/dev/sparktestsupport/shellutils.py
diff options
context:
space:
mode:
authorJosh Rosen <joshrosen@databricks.com>2016-06-16 14:18:58 -0700
committerAndrew Or <andrew@databricks.com>2016-06-16 14:18:58 -0700
commitacef843f67e770f0a2709fb3fbd1a53c200b2bc5 (patch)
treec976ba421b7bbd85f6281dda6c6e8f221dd3bd7b /dev/sparktestsupport/shellutils.py
parentbbad4cb48df2ac3ed7edb4c02db79540bd4085d8 (diff)
downloadspark-acef843f67e770f0a2709fb3fbd1a53c200b2bc5.tar.gz
spark-acef843f67e770f0a2709fb3fbd1a53c200b2bc5.tar.bz2
spark-acef843f67e770f0a2709fb3fbd1a53c200b2bc5.zip
[SPARK-15975] Fix improper Popen retcode code handling in dev/run-tests
In the `dev/run-tests.py` script we check a `Popen.retcode` for success using `retcode > 0`, but this is subtlety wrong because Popen's return code will be negative if the child process was terminated by a signal: https://docs.python.org/2/library/subprocess.html#subprocess.Popen.returncode In order to properly handle signals, we should change this to check `retcode != 0` instead. Author: Josh Rosen <joshrosen@databricks.com> Closes #13692 from JoshRosen/dev-run-tests-return-code-handling.
Diffstat (limited to 'dev/sparktestsupport/shellutils.py')
-rw-r--r--dev/sparktestsupport/shellutils.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/dev/sparktestsupport/shellutils.py b/dev/sparktestsupport/shellutils.py
index d280e79707..05af87189b 100644
--- a/dev/sparktestsupport/shellutils.py
+++ b/dev/sparktestsupport/shellutils.py
@@ -53,7 +53,10 @@ else:
def exit_from_command_with_retcode(cmd, retcode):
- print("[error] running", ' '.join(cmd), "; received return code", retcode)
+ if retcode < 0:
+ print("[error] running", ' '.join(cmd), "; process was terminated by signal", -retcode)
+ else:
+ print("[error] running", ' '.join(cmd), "; received return code", retcode)
sys.exit(int(os.environ.get("CURRENT_BLOCK", 255)))