Added check for return value of 0 from poll(), to handle the case where the process that was launched exited immediately without error

This commit is contained in:
Brian Gerkey 2010-06-05 19:43:01 +00:00
parent ba394e6d7c
commit 4338ea4323
1 changed files with 5 additions and 1 deletions

View File

@ -292,7 +292,11 @@ executable permission. This is often caused by a bad launch-prefix."""%(msg, ' '
raise FatalProcessLaunch("unable to launch [%s]: %s"%(' '.join(self.args), msg))
self.started = True
if self.popen.poll() is None:
# Check that the process is either still running (poll returns
# None) or that it completed successfully since when we
# launched it above (poll returns the return code, 0).
poll_result = self.popen.poll()
if poll_result is None or poll_result == 0:
self.pid = self.popen.pid
printlog_bold("process[%s]: started with pid [%s]"%(self.name, self.pid))
return True