479 def runbgcommand(script, env, shell=False, stdout=None, stderr=None): |
479 def runbgcommand(script, env, shell=False, stdout=None, stderr=None): |
480 '''Spawn a command without waiting for it to finish.''' |
480 '''Spawn a command without waiting for it to finish.''' |
481 # we can't use close_fds *and* redirect stdin. I'm not sure that we |
481 # we can't use close_fds *and* redirect stdin. I'm not sure that we |
482 # need to because the detached process has no console connection. |
482 # need to because the detached process has no console connection. |
483 subprocess.Popen( |
483 subprocess.Popen( |
484 script, shell=shell, env=env, close_fds=True, |
484 tonativestr(script), |
485 creationflags=_creationflags, stdout=stdout, stderr=stderr) |
485 shell=shell, env=tonativeenv(env), close_fds=True, |
|
486 creationflags=_creationflags, stdout=stdout, |
|
487 stderr=stderr) |
486 else: |
488 else: |
487 def runbgcommand(cmd, env, shell=False, stdout=None, stderr=None): |
489 def runbgcommand(cmd, env, shell=False, stdout=None, stderr=None): |
488 '''Spawn a command without waiting for it to finish.''' |
490 '''Spawn a command without waiting for it to finish.''' |
489 # double-fork to completely detach from the parent process |
491 # double-fork to completely detach from the parent process |
490 # based on http://code.activestate.com/recipes/278731 |
492 # based on http://code.activestate.com/recipes/278731 |