in reply to Re^4: Perl Background processes in Windows
in thread Perl Background processes in Windows
Consider looking at perlop to see what -x does. Also, if it "always fails" (and you're interested in learning why), consider posting full code.
Please note that dir and date are shell builtins in cmd.exe and thus never pass -x, because they are not programs that can be run. Also note that -x expects the full path to an executable and does not search $ENV{PATH}. Whether that is desired or not in the context of the above program, I don't know. Update: As the argument is passed to Win32::Process::Create(...), it makes sense to have a fully specified path, because that's what Win32::Process::Create() likely wants.
>perl -wle "print $_, -x $_ ? ' yes':' no' for @ARGV" cmd.exe c:\WINDO +WS\system32\cmd.exe cmd.exe no c:\WINDOWS\system32\cmd.exe yes
As to using system or backticks, these do not launch a background process. Which seems to be the purpose of the code under discussion. Actually, perlport points out system(1, ...) for launching a process in the background under Windows and OS/2.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Perl Background processes in Windows
by Anonymous Monk on Jan 31, 2012 at 10:32 UTC | |
by gepebril69 (Scribe) on Jan 31, 2012 at 14:30 UTC |