##// END OF EJS Templates
Suppress SystemExit tracebacks in %run for scripts that correctly set their exit status to 0. This obviates the need for -e in such cases, of which unittest runs are the best example.
fperez -
Show More
@@ -6,7 +6,7 b' Requires Python 2.3 or newer.'
6
6
7 This file contains all the classes and helper functions specific to IPython.
7 This file contains all the classes and helper functions specific to IPython.
8
8
9 $Id: iplib.py 2602 2007-08-12 22:45:38Z fperez $
9 $Id: iplib.py 2606 2007-08-13 12:44:48Z fperez $
10 """
10 """
11
11
12 #*****************************************************************************
12 #*****************************************************************************
@@ -2486,7 +2486,12 b' want to merge them back into the new files.""" % locals()'
2486 self.showsyntaxerror()
2486 self.showsyntaxerror()
2487 warn('Failure executing file: <%s>' % fname)
2487 warn('Failure executing file: <%s>' % fname)
2488 except SystemExit,status:
2488 except SystemExit,status:
2489 if not kw['exit_ignore']:
2489 #print 'STATUS:',status # dbg
2490 if status.message!=0 and not kw['exit_ignore']:
2491 # Code that correctly sets the exit status flag to success
2492 # (0) shouldn't be bothered with a traceback. Note that a
2493 # plain sys.exit() does NOT set the message to 0 (it's
2494 # empty) so that will still get a traceback.
2490 self.showtraceback()
2495 self.showtraceback()
2491 warn('Failure executing file: <%s>' % fname)
2496 warn('Failure executing file: <%s>' % fname)
2492 except:
2497 except:
@@ -1,3 +1,12 b''
1 2007-08-13 Fernando Perez <Fernando.Perez@colorado.edu>
2
3 * IPython/iplib.py (safe_execfile): modify so that running code
4 which calls sys.exit(0) (or equivalently, raise SystemExit(0))
5 doesn't get a printed traceback. Any other value in sys.exit(),
6 including the empty call, still generates a traceback. This
7 enables use of %run without having to pass '-e' for codes that
8 correctly set the exit status flag.
9
1 2007-08-12 Fernando Perez <Fernando.Perez@colorado.edu>
10 2007-08-12 Fernando Perez <Fernando.Perez@colorado.edu>
2
11
3 * IPython/iplib.py (InteractiveShell.post_config_initialization):
12 * IPython/iplib.py (InteractiveShell.post_config_initialization):
General Comments 0
You need to be logged in to leave comments. Login now