This commit is contained in:
Anthony Scopatz 2020-03-01 15:06:33 -05:00 committed by GitHub
parent b37675a6e8
commit 2e30f330c0
Failed to generate hash of commit
3 changed files with 34 additions and 1 deletions

25
news/exitcode.rst Normal file
View file

@ -0,0 +1,25 @@
**Added:**
* <news item>
**Changed:**
* <news item>
**Deprecated:**
* <news item>
**Removed:**
* <news item>
**Fixed:**
* Fixed issue where negative exit codes (such as those produced
by core dumps) where treated as logical successes when chaining
processes with other boolean expressions.
**Security:**
* <news item>

View file

@ -559,3 +559,11 @@ def test_pipe_between_subprocs(cmd, fmt, exp):
"verify pipe between subprocesses doesn't throw an exception"
check_run_xonsh(cmd, fmt, exp)
@skip_if_on_windows
def test_negative_exit_codes_fail():
# see issue 3309
script = 'python -c "import os; os.abort()" && echo OK\n'
out, err, rtn = run_xonsh(script)
assert "OK" is not out
assert "OK" is not err

View file

@ -2288,7 +2288,7 @@ class CommandPipeline:
rtn = self.returncode
if (
rtn is not None
and rtn > 0
and rtn != 0
and builtins.__xonsh__.env.get("RAISE_SUBPROC_ERROR")
):
try: