##// END OF EJS Templates
Avoid error while killing subprocess in %%script
Takafumi Arakaki -
Show More
@@ -208,6 +208,7 b' class ScriptMagics(Magics, Configurable):'
208 try:
208 try:
209 out, err = p.communicate(cell)
209 out, err = p.communicate(cell)
210 except KeyboardInterrupt:
210 except KeyboardInterrupt:
211 try:
211 p.send_signal(signal.SIGINT)
212 p.send_signal(signal.SIGINT)
212 time.sleep(0.1)
213 time.sleep(0.1)
213 if p.poll() is not None:
214 if p.poll() is not None:
@@ -220,6 +221,8 b' class ScriptMagics(Magics, Configurable):'
220 return
221 return
221 p.kill()
222 p.kill()
222 print "Process is killed."
223 print "Process is killed."
224 except:
225 print "Failed to kill process properly (pid={0})".format(p.pid)
223 return
226 return
224 out = py3compat.bytes_to_str(out)
227 out = py3compat.bytes_to_str(out)
225 err = py3compat.bytes_to_str(err)
228 err = py3compat.bytes_to_str(err)
General Comments 0
You need to be logged in to leave comments. Login now