The following returns -1 on Unix,
As does this:DB<5> x (system 'jxdDoesNotExist'), $?, $! Can't exec "jxdDoesNotExist": No such file or directory at 0 '-1' 1 '-1' 2 'No such file or directory'
But on Windows...DB<7> x (system {'jxdDoesNotExist'} 'jxdDoesNotExist'), $?, $! Can't exec "jxdDoesNotExist": No such file or directory at 0 '-1' 1 '-1' 2 'No such file or directory'
The second Windows 'system' call makes some sense (the error code is from cmd.exe), based on the following snippet from 'perldoc -f system':DB<3> x (system {'jxdDoesNotExist'} 'jxdDoesNotExist'), $?, $!, $^E 0 65280 1 65280 2 'No such file or directory' 3 'The system cannot find the file specified' DB<4> x (system 'jxdDoesNotExist'), $?, $!, $^E 'jxdDoesNotExist' is not recognized as an internal or external command +, operable program or batch file. 0 256 1 256 2 'No such file or directory' 3 'Access is denied'
... On Windows, only the "system PROGRAM
LIST" syntax will reliably avoid using the shell; "system LIST",
even with more than one element, will fall back to the shell if
the first spawn fails.
and from 'perlport'
exec "exec LIST" without the use of indirect object syntax ("exec
PROGRAM LIST") may fall back to trying the shell if the first
spawn() fails. (Win32)
combined with this snippet from 'perldoc -f system':
Like "exec", "system" allows you to lie to a program about its
name if you use the "system PROGRAM LIST" syntax. Again, see
"exec".
But the 65280 code from the Windows "system PROGRAM LIST" syntax perplexes me. If perl knows the command failed to launch, shouldn't system return '-1' (as documented!!!) ?
See also rt://46333 and rt://95308, which led me to this question
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |