#59 CreateProcess doesn't sort environment block

open
nobody
win32 (43)
5
2007-03-23
2007-03-23
Dwig
No

Win32 CreateProcess requires that the environment block be sorted alphabetically, case-insensitive. This isn't currently done by win32process, so subprocesses won't see all the environment vars in the dictionary. See the thread around http://mail.python.org/pipermail/python-dev/2004-October/049656.html
for a discussion of this, and how to solve it.

(This also affects the Popen class in the subprocess module, which takes an env argument and calls CreateProcess.)

Discussion

  • Trent Mick
    Trent Mick
    2007-03-26

    Logged In: YES
    user_id=34892
    Originator: NO

    I'll attach the patch that I am using for this in ActivePython builds. It doesn't do the absolutely correct thing as per the python-dev discussion you linked to. It is, instead, a "good enough for me so far" solution -- where "me" is usage in Komodo, where we hit the bug initially.

     
  • Trent Mick
    Trent Mick
    2007-03-26

    Logged In: YES
    user_id=34892
    Originator: NO

    Uh, I *would* attach the patch, but I don't see how to do that on this bug item. SF Tracker sucks. The patch is here instead:

    http://trentm.com/patches/pywin32_createprocess_env_fix.patch