[Buildbot-devel] win32 create process info
    Cory Dodt 
    corydodt at twistedmatrix.com
       
    Tue Apr 26 21:06:58 UTC 2005
    
    
  
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Brian Warner wrote:
| I'm assuming that os.environ['COMSPEC'] is generally equal to "cmd.exe".
Generally.  On win9x it's "command.com".
| If I
| change this code to:
|
|         if type(self.command) in types.StringTypes:
|             if runtime.platformType  == 'win32':
|                 argv = [os.environ['COMSPEC'], '/c', self.command]
|             else:
|                 # for posix, use /bin/sh. for other non-posix, well, doesn't
|                 # hurt to try
|                 argv = ['/bin/sh', '-c', self.command]
|         else:
|             if runtime.platformType  == 'win32':
|                 argv = [os.environ['COMSPEC'], '/c'] + list(self.command)
|             else:
|                 argv = self.command
|
| then will it work for a command that has spaces in it? The /bin/sh route
| re-parses the argv elements and splits on spaces.. does cmd.exe do the same?
~From very rudimentary experimentation it looks like both of these do the same
thing:
cmd /c "dir c:\windows"
cmd /c dir c:\windows
However, this (executed from bash) does something completely different:
~    cory ~% cmd /c 'dir "c:\documents and settings"'
~    The filename, directory name, or volume label syntax is incorrect.
It looks like it's tokenizing this command line without removing the quotes.
Better use shlex.split() on self.command.
C
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFCbq1y3A5SrXAiHQcRAnSzAJ4rNFcqXXvnKpeN1kj0CHpp79DUVQCfYzxh
HB1GDqfY2y6rm+4UkD9b2O4=
=6zEQ
-----END PGP SIGNATURE-----
    
    
More information about the devel
mailing list