in reply to IPC::Run on Windows, path separator

Its invoking the shell, so I don't think its a bug, but I'm not sure what IPC::Run promises
$ cat _testdir_\_test_.bat @echo %date% %time% $ cat runit.pl use IPC::Run; IPC::Run::run(['_testdir_/_test_.bat']); IPC::Run::run(['_testdir_\\_test_.bat']) ; $ perl runit.pl '_testdir_' is not recognized as an internal or external command, operable program or batch file. Thu 05/27/2010 6:47:20.93 $ _testdir_\_test_.bat Thu 05/27/2010 6:47:27.87 $ _testdir_/_test_.bat '_testdir_' is not recognized as an internal or external command, operable program or batch file.

Replies are listed 'Best First'.
Re^2: IPC::Run on Windows, path separator
by rovf (Priest) on May 27, 2010 at 14:14 UTC
    Its invoking the shell
    I would not expect that it does. From the perldocs:

    # Launch a sub process directly, no shell. Can't do redirectio +n # with this form, it's here to behave like system() with an # inverted result. $r = run "cat a b c" ;
    So this example explicitly says no shell.

    -- 
    Ronald Fischer <ynnor@mm.st>
      system calls the shell when it's documented not to in Windows. According to the documentation, perl -e"system('dir')" and perl -e"system('foo.bat')" should fail, yet both work. This might be documented in perlport.

        Please call for the documentation to change, not the implementation. It's a few little details like this that make perl usable on windows.

        Indeed! OTOH, IPC::Run::run(['echo xxx']) fails....

        -- 
        Ronald Fischer <ynnor@mm.st>
      You're giving it a batch file, and only the shell runs batch files, so both the following lines work for me
      IPC::Run::run(['C:/perl/5.10.1/bin/MSWin32-x86-multi-thread/perl.EXE', + qw! -e die(666) !]) ; IPC::Run::run(['C:\perl\5.10.1\bin\MSWin32-x86-multi-thread\perl.EXE', + qw! -e die(666) !]) ;
        Good point! Thanks a lot!

        -- 
        Ronald Fischer <ynnor@mm.st>
Re^2: IPC::Run on Windows, path separator (abs)
by tye (Sage) on May 28, 2010 at 01:54 UTC

    Interesting which cases work:

    C:\>c:/windows/explorer C:\>/windows/explorer C:\>windows/explorer 'windows' is not recognized as an internal or external command, operable program or batch file. C:\>

    - tye        

      Quotes almost always prevent the "/" from being treated as an option prefix.
      C:\>"windows/explorer" C:\>