Nope, exec doesn't care about path, the OS cares about path
| [reply] |
| [reply] [d/l] |
... why ...
Hmm, found a bug, exec appears to cache path, so it works even if you undef $ENV{PATH}, where as system fails -- I still can't replicate the OPs condition :)
- # path is undef from perl, system fails
-
$ perl -V:yo -Te " undef $ENV{PATH}; system q/perl -e die /"
yo='UNKNOWN';
- # path is undef from perl, exec succeeds
-
$ perl -V:yo -Te " undef $ENV{PATH}; exec q/perl -e die /"
yo='UNKNOWN';
$ Died at -e line 1.
- # path is undef from cmd.exe, exec fails
-
$ set path=
$ C:\perl\5.12.2\bin\MSWin32-x86-multi-thread\perl.exe -V:yo -Te " und
+ef $ENV{PATH}; exec qw/perl -e die /"
yo='UNKNOWN';
-
# using the shell works, perl dies -
$ perl -le " exec q{C:\WINDOWS\system32\cmd.exe /x /c }.qq{\x22perl -
+e die\x22}; "
$ Died at -e line 1.
- # works , absolute path, cmd successfully launched, fails to find perl
-
$ perl -le " undef $ENV{PATH}; exec q{C:\WINDOWS\system32\cmd.exe /x /
+c }.qq{\x22perl -e die\x22}; "
$ 'perl' is not recognized as an internal or external command,
operable program or batch file.
- # shouldn't work, cmd.exe is still found but it shouldn't be found with a relative path and undef PATH
-
$ perl -V:yo -le " undef $ENV{PATH}; exec q{cmd.exe /x /c }.qq{\x22per
+l -e die\x22}; "
yo='UNKNOWN';
$ 'perl' is not recognized as an internal or external command,
operable program or batch file.
- # works, cmd.exe is not found
-
$ set path=
$ C:\perl\5.12.2\bin\MSWin32-x86-multi-thread\perl.exe -V:yo -le " un
+def $ENV{PATH}; exec q{cmd.exe /x /c }.qq{\x22perl
-e die\x22}; "
yo='UNKNOWN';
http://perl5.git.perl.org/perl.git?a=search&h=HEAD&st=grep&s=_exec
- Perl_do_exec http://perl5.git.perl.org/perl.git/blob?f=win32/win32.c#l762
- win32_execvp http://perl5.git.perl.org/perl.git/blob?f=win32/win32.c#l3644
- win32_spawnvp http://perl5.git.perl.org/perl.git/blob?f=win32/win32.c#l3471
| [reply] [d/l] [select] |