[Buildbot-devel] win32 create process info
Mike Taylor
bear at code-bear.com
Tue Apr 26 04:31:00 UTC 2005
While working out why the win32 buildslave for buildbot was having
issues I found some interesting info about spawning processes inside of
Python. This is probably nothing new to most of you but I figured I
would post here to get some feedback and also to allow people to find
the info later if they need it.
My use of the word 'we' below is "we" = "everyone on irc this
afternoon" :)
The first issue that we were having was that we didn't seem to be able
to run the following from the command line:
twistd --help
Instead of seeing the output from twistd.py you would get an error.
After some talking online, we were told to try twisted's twistenv.bat
to set up the environment to allow that. After some testing we quickly
found that the current twistenv.bat is not setting PATHEXT properly.
After adding ;.PY to the global PATHEXT it worked.
Unfortunately that still was not allowing the win32 buildslave to run
trial - now we were getting "file not found" errors in the tracebacks.
Looking at how buildbot ran slave commands (buildbot/slave/commands.py,
line 165) I found that it's calling the twisted reactor's
spawnProcess() method which in the win32 reactor ends up calling the
win32 api createprocess()
(twisted/internet/reactor/win32eventreactor.py) -- that actually made
sense until I reviewed the docs on createprocess.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/
dllproc/base/createprocess.asp
and was reminded of how "helpful" microsoft api's are :( The pertinent
part can be found in paragraph 3 (or so) of the lpCommandLine parameter
description, quoted below:
If the file name does not contain an extension, .exe is appended.
Therefore, if the file name extension is .com, this parameter must
include the .com extension.
If the file name ends in a period (.) with no extension, or if the
file name contains a path, .exe is not appended.
The twisted call passes None to the first parameter (lpApplicationName)
and builds the commandline by joining the command with it's parameters.
Since buildbot is passing "trial" as the command, createprocess seems
to be helpfully trying to search the path for "trial.exe" and is not
finding it. In order for buildbot to not have the .exe appended it
would have to add the path to the command which is information that I
don't believe the build master even knows about.
To test my theory I copied a do-nothing .exe over to where trial.py
lives and named it trial.exe and then told the buildslave to force a
build. Sure enough, the "trial" command worked (well it ran that is)
and no exceptions were generated.
So, to summarize, it seems that if buildbot is going to use the win32
reactor then either full paths will be needed or the command call will
have to be changed to have cmd.exe be the application name and trial be
part of the command line parameters. cmd.exe searches the path and
honors the PATHEXT settings.
Hope this helps,
---
Bear
http://code-bear.com
Open Source Applications Foundation (OSAF)
http://www.osafoundation.org
PGP Fingerprint = 9996 719F 973D B11B E111 D770 9331 E822 40B3 CD29
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
URL: <http://buildbot.net/pipermail/devel/attachments/20050426/287cbc34/attachment.bin>
More information about the devel
mailing list