##// END OF EJS Templates
Backport PR #2799: Exit code...
MinRK -
Show More
@@ -2206,6 +2206,10 b' class InteractiveShell(SingletonConfigurable):'
2206 2206 else:
2207 2207 cmd = py3compat.unicode_to_str(cmd)
2208 2208 ec = os.system(cmd)
2209 # The high byte is the exit code, the low byte is a signal number
2210 # that we discard for now. See the docs for os.wait()
2211 if ec > 255:
2212 ec >>= 8
2209 2213
2210 2214 # We explicitly do NOT return the subprocess status code, because
2211 2215 # a non-None value would trigger :func:`sys.displayhook` calls.
@@ -402,6 +402,11 b' class TestSystemRaw(unittest.TestCase):'
402 402 cmd = ur'''python -c "'åäö'" '''
403 403 ip.system_raw(cmd)
404 404
405 def test_exit_code(self):
406 """Test that the exit code is parsed correctly."""
407 ip.system_raw('exit 1')
408 self.assertEqual(ip.user_ns['_exit_code'], 1)
409
405 410 class TestModules(unittest.TestCase, tt.TempFileMixin):
406 411 def test_extraneous_loads(self):
407 412 """Test we're not loading modules on startup that we shouldn't.
General Comments 0
You need to be logged in to leave comments. Login now