##// END OF EJS Templates
safe_run_module: Ignore SystemExit codes 0 and None.
Bradley M. Froehle -
Show More
@@ -2483,7 +2483,7 b' class InteractiveShell(SingletonConfigurable):'
2483 # explicitly silenced, but only in short form.
2483 # explicitly silenced, but only in short form.
2484 if kw['raise_exceptions']:
2484 if kw['raise_exceptions']:
2485 raise
2485 raise
2486 if status.code not in (0, None) and not kw['exit_ignore']:
2486 if status.code and not kw['exit_ignore']:
2487 self.showtraceback(exception_only=True)
2487 self.showtraceback(exception_only=True)
2488 except:
2488 except:
2489 if kw['raise_exceptions']:
2489 if kw['raise_exceptions']:
@@ -2532,6 +2532,8 b' class InteractiveShell(SingletonConfigurable):'
2532 This version will never throw an exception, but instead print
2532 This version will never throw an exception, but instead print
2533 helpful error messages to the screen.
2533 helpful error messages to the screen.
2534
2534
2535 `SystemExit` exceptions with status code 0 or None are ignored.
2536
2535 Parameters
2537 Parameters
2536 ----------
2538 ----------
2537 mod_name : string
2539 mod_name : string
@@ -2540,10 +2542,14 b' class InteractiveShell(SingletonConfigurable):'
2540 The globals namespace.
2542 The globals namespace.
2541 """
2543 """
2542 try:
2544 try:
2543 where.update(
2545 try:
2544 runpy.run_module(str(mod_name), run_name="__main__",
2546 where.update(
2545 alter_sys=True)
2547 runpy.run_module(str(mod_name), run_name="__main__",
2546 )
2548 alter_sys=True)
2549 )
2550 except SystemExit as status:
2551 if status.code:
2552 raise
2547 except:
2553 except:
2548 self.showtraceback()
2554 self.showtraceback()
2549 warn('Unknown failure executing module: <%s>' % mod_name)
2555 warn('Unknown failure executing module: <%s>' % mod_name)
General Comments 0
You need to be logged in to leave comments. Login now