[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: PATH & Perl 5.6 on Win32 ?
From: |
'Trent Mick' |
Subject: |
Re: PATH & Perl 5.6 on Win32 ? |
Date: |
Tue, 10 Apr 2001 18:47:58 -0700 |
User-agent: |
Mutt/1.2i |
On Tue, Apr 10, 2001 at 06:00:04PM -0700, Eric Brown wrote:
> The bug isn't that the copy of the path passed to the child is wrong, it's
> that the environment *at the time CreateProcess() is called* is wrong.
Here was Sarathy's answer to that:
> >But it works in Python. :) Oh well.
>
> Probably because Python uses MSVCRT's spawnvp() to implement system().
> IIRC, MSVCRT will attempt to locate the file by navigating the PATH,
> and give up if it can't "find" it. (The rules for what constitutes
> "finding" it are fuzzy, and subject to MSVCRT bugs.)
>
> To avoid any MSVCRT issues, Perl calls CreateProcess() directly, and
> doesn't attempt to locate the file by itself--instead, it lets the OS
> find it using its "normal" rules. MSVCRT's rules may be more "normal"
> in some situations, but what the OS does is distinctly better in others.
>
> It's hard to implement both kinds of bugs simultaneously. :-)
[Eric Brown]:
> Running everything in a subshell will work, at the cost of losing the exit
> code - cmd -c and cmd -k return the exit code of *cmd.exe*, not the
> executed process.
What I do it take the user's list of commands and wrap them in a tmp batch
file that looks like this:
<user's commands>
exit %ERRORLEVEL%
Then run "cmd /C <batfilename>". That should get the correct return value
back.
Maybe Cons could be setup to do this in the background. Or would that be
evil? I am not a Cons guru so I don't know if that would break other things.
Trent
--
Trent Mick
address@hidden