Skip to content

Commit a80cd52

Browse files
dylexmbmilligan
authored andcommitted
Fix exception handling in run_command (#61)
Import subprocess for CalledProcess error and remove references to self.log, not defined outside Spawner classes.
1 parent 1a5cd4e commit a80cd52

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

batchspawner/batchspawner.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
from tornado import gen
2424
from tornado.process import Subprocess
25+
from subprocess import CalledProcessError
2526
from tornado.iostream import StreamClosedError
2627

2728
from jupyterhub.spawner import Spawner
@@ -52,9 +53,9 @@ def run_command(cmd, input=None, env=None):
5253
eout = eout.decode().strip()
5354
try:
5455
err = yield proc.wait_for_exit()
55-
except subprocess.CalledProcessError:
56-
self.log.error("Subprocess returned exitcode %s" % proc.returncode)
57-
self.log.error(eout)
56+
except CalledProcessError:
57+
#self.log.error("Subprocess returned exitcode %s" % proc.returncode)
58+
#self.log.error(eout)
5859
raise RuntimeError(eout)
5960
if err != 0:
6061
return err # exit error?

0 commit comments

Comments
 (0)