Show More
@@ -8,7 +8,7 b' import os' | |||
|
8 | 8 | import sys |
|
9 | 9 | import signal |
|
10 | 10 | import time |
|
11 | from subprocess import Popen, PIPE | |
|
11 | from subprocess import Popen, PIPE, CalledProcessError | |
|
12 | 12 | import atexit |
|
13 | 13 | |
|
14 | 14 | from IPython.core import magic_arguments |
@@ -54,6 +54,12 b' def script_args(f):' | |||
|
54 | 54 | This is used only when --bg option is given. |
|
55 | 55 | """ |
|
56 | 56 | ), |
|
57 | magic_arguments.argument( | |
|
58 | '--raise-error', action="store_true", | |
|
59 | help="""Whether you should raise an error message in addition to | |
|
60 | a stream on stderr if you get a nonzero exit code. | |
|
61 | """ | |
|
62 | ) | |
|
57 | 63 | ] |
|
58 | 64 | for arg in args: |
|
59 | 65 | f = arg(f) |
@@ -235,6 +241,8 b' class ScriptMagics(Magics):' | |||
|
235 | 241 | else: |
|
236 | 242 | sys.stderr.write(err) |
|
237 | 243 | sys.stderr.flush() |
|
244 | if args.raise_error and p.returncode!=0: | |
|
245 | raise CalledProcessError(p.returncode, cell, output=out, stderr=err) | |
|
238 | 246 | |
|
239 | 247 | def _run_script(self, p, cell, to_close): |
|
240 | 248 | """callback for running the script in the background""" |
General Comments 0
You need to be logged in to leave comments.
Login now