[Buildbot-devel] Running Pythonscript

Brian Warner warner-buildbot at lothar.com
Thu Aug 28 18:04:13 UTC 2008


> I run them in a script called by a ShellCommand. I replaced all the
> os.system() calls by subprocess.Popen("mycmd",shell=True,stdout=PIPE)
> this works. But i still wonder why os.system() and os.Popen are
> ignored.

os.system() and subprocess.Popen frequently do not work in a Twisted-based
program that has claimed the SIGCHLD handler, since there can only be one
SIGCHLD handler at a time. The usual symptom is that the child process
appears to never finish, but I've seen weirder behavior too.

Take a look at reactor.spawnProcess[1], and look at the code in buildbot[2]
that uses it, that's the way to spawn a child process in a reactor-based
program.

hope that helps,
 -Brian


[1]: http://twistedmatrix.com/documents/current/api/twisted.internet.interfaces.IReactorProcess.html
[2]: http://buildbot.net/trac/browser/buildbot/slave/commands.py#L412




More information about the devel mailing list