##// END OF EJS Templates
Backport PR #2924: safe_run_module: Silence SystemExit codes 0 and None....
MinRK -
Show More
@@ -2445,7 +2445,7 b' class InteractiveShell(SingletonConfigurable):'
2445 2445 # explicitly silenced, but only in short form.
2446 2446 if kw['raise_exceptions']:
2447 2447 raise
2448 if status.code not in (0, None) and not kw['exit_ignore']:
2448 if status.code and not kw['exit_ignore']:
2449 2449 self.showtraceback(exception_only=True)
2450 2450 except:
2451 2451 if kw['raise_exceptions']:
@@ -2494,6 +2494,8 b' class InteractiveShell(SingletonConfigurable):'
2494 2494 This version will never throw an exception, but instead print
2495 2495 helpful error messages to the screen.
2496 2496
2497 `SystemExit` exceptions with status code 0 or None are ignored.
2498
2497 2499 Parameters
2498 2500 ----------
2499 2501 mod_name : string
@@ -2502,10 +2504,14 b' class InteractiveShell(SingletonConfigurable):'
2502 2504 The globals namespace.
2503 2505 """
2504 2506 try:
2507 try:
2505 2508 where.update(
2506 2509 runpy.run_module(str(mod_name), run_name="__main__",
2507 2510 alter_sys=True)
2508 2511 )
2512 except SystemExit as status:
2513 if status.code:
2514 raise
2509 2515 except:
2510 2516 self.showtraceback()
2511 2517 warn('Unknown failure executing module: <%s>' % mod_name)
General Comments 0
You need to be logged in to leave comments. Login now