Show More
@@ -199,6 +199,7 b' class ScriptMagics(Magics):' | |||||
199 | _handle_stream(process.stderr, args.err, sys.stderr) |
|
199 | _handle_stream(process.stderr, args.err, sys.stderr) | |
200 | ) |
|
200 | ) | |
201 | await asyncio.wait([stdout_task, stderr_task]) |
|
201 | await asyncio.wait([stdout_task, stderr_task]) | |
|
202 | await process.wait() | |||
202 |
|
203 | |||
203 | if sys.platform.startswith("win"): |
|
204 | if sys.platform.startswith("win"): | |
204 | asyncio.set_event_loop_policy(asyncio.WindowsProactorEventLoopPolicy()) |
|
205 | asyncio.set_event_loop_policy(asyncio.WindowsProactorEventLoopPolicy()) | |
@@ -264,7 +265,11 b' class ScriptMagics(Magics):' | |||||
264 | print("Error while terminating subprocess (pid=%i): %s" % (p.pid, e)) |
|
265 | print("Error while terminating subprocess (pid=%i): %s" % (p.pid, e)) | |
265 | return |
|
266 | return | |
266 | if args.raise_error and p.returncode!=0: |
|
267 | if args.raise_error and p.returncode!=0: | |
267 | raise CalledProcessError(p.returncode, cell) |
|
268 | # If we get here and p.returncode is still None, we must have | |
|
269 | # killed it but not yet seen its return code. We don't wait for it, | |||
|
270 | # in case it's stuck in uninterruptible sleep. -9 = SIGKILL | |||
|
271 | rc = p.returncode or -9 | |||
|
272 | raise CalledProcessError(rc, cell) | |||
268 |
|
273 | |||
269 | def _run_script(self, p, cell, to_close): |
|
274 | def _run_script(self, p, cell, to_close): | |
270 | """callback for running the script in the background""" |
|
275 | """callback for running the script in the background""" |
General Comments 0
You need to be logged in to leave comments.
Login now