Skip to content

Commit

Permalink
experimental hack to work around the fact that windows cant track its…
Browse files Browse the repository at this point in the history
… children
  • Loading branch information
stonier committed Mar 13, 2013
1 parent e447225 commit 60ee92a
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tools/roslaunch/src/roslaunch/nodeprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,18 @@ def start(self):
_logger.info("process[%s]: cwd will be [%s]", self.name, cwd)

try:
self.popen = subprocess.Popen(self.args, cwd=cwd, stdout=logfileout, stderr=logfileerr, env=full_env, close_fds=True, preexec_fn=os.setsid)
preexec_function = os.setsid
close_file_descriptor=True
except AttributeError:
# No way to manage these on windows without setsid and close_fds
# This is not a real solution, we need a better way.
# setsid is there so we can kill children, without it, they are left as zombies
# so like this, windows won't be able to kill children that have been forked off
# by programs on their own
preexec_function = None
close_file_descriptor=False
try:
self.popen = subprocess.Popen(self.args, cwd=cwd, stdout=logfileout, stderr=logfileerr, env=full_env, close_fds=close_file_descriptor, preexec_fn=preexec_function)
except OSError, (errno, msg):
self.started = True # must set so is_alive state is correct
_logger.error("OSError(%d, %s)", errno, msg)
Expand Down

0 comments on commit 60ee92a

Please sign in to comment.