diff --git a/sudospawner/spawner.py b/sudospawner/spawner.py index a0c6d1e..1c676e9 100644 --- a/sudospawner/spawner.py +++ b/sudospawner/spawner.py @@ -47,6 +47,9 @@ def relog_stderr(self, stderr): # [I date JupyterHub] [W date SingleUser] msg... sys.stderr.write(line.decode('utf8', 'replace')) + def make_preexec_fn(self): + return None + @gen.coroutine def do(self, action, **kwargs): """Instruct the mediator process to take a given action""" @@ -58,7 +61,7 @@ def do(self, action, **kwargs): cmd.append('--logging=debug') self.log.debug("Spawning %s", cmd) - p = Subprocess(cmd, stdin=Subprocess.STREAM, stdout=Subprocess.STREAM, stderr=Subprocess.STREAM) + p = Subprocess(cmd, stdin=Subprocess.STREAM, stdout=Subprocess.STREAM, stderr=Subprocess.STREAM, preexec_fn=self.make_preexec_fn()) stderr_future = self.relog_stderr(p.stderr) # hand the stderr future to the IOLoop so it isn't orphaned, # even though we aren't going to wait for it unless there's an error @@ -109,4 +112,3 @@ def _signal(self, sig): return True reply = yield self.do('kill', pid=self.pid, signal=sig) return reply['alive'] -