[PATCH 1 of 1] util.system: Clear environment vars before deleting
Mads Kiilerich
mads at kiilerich.com
Sun Sep 20 15:20:32 CDT 2009
Danek Duvall wrote, On 09/20/2009 05:40 PM:
> Mads Kiilerich wrote:
>
>
>> if prevgitdir is None:
>> + os.environ['GIT_DIR'] = '' # del is noop on solaris
>> del os.environ['GIT_DIR']
>> else:
>> os.environ['GIT_DIR'] = prevgitdir
>>
> Wouldn't it be better, in general, to use the subprocess module directly,
> and pass in the explicit environment? I know that's a bit more work than
> tweaking individual environment variables to suit the situation, but I
> don't think that the latter is ever guaranteed to work (or, at least, the
> situations where it doesn't always seem to be more than you'd expect).
>
Yes, with Mercurial 1.3 where Python 2.4 is required we could rely on
subprocess instead.
The change is simple, but I'm sure it will have some side effects on
some platforms. Let's try and see!
(Danek: Perhaps you could convince some engineers with email adresses
similar to yours to come up with a patch for a working unsetenv and "del
os.environ[env]" in Python? That would give less bad PR ;-)
/Mads
More information about the Mercurial-devel
mailing list