ipc-system-simple icon indicating copy to clipboard operation
ipc-system-simple copied to clipboard

Multi-argument run() fails on Windows when first parameter is a full path that contains spaces

Open mattjacob opened this issue 7 years ago • 3 comments

Tests 1 and 2 below fail, but 3 and 4 work. The third one isn't great, because it makes me responsible for properly quoting the entire command. The fourth one isn't great either, because the thing we want to run might not be in the PATH.

use strict;
use warnings;

use Data::Dumper;
use IPC::System::Simple qw(run);

my @tests = (
    ['C:\Program Files\TortoiseSVN\bin\svn.exe', 'help'],
    ['"C:\Program Files\TortoiseSVN\bin\svn.exe"', 'help'],
    ['"C:\Program Files\TortoiseSVN\bin\svn.exe" help'],
    ['svn', 'help'],
);

for (@tests) {
    print "Running with run(): ", Dumper($_), "\n";

    eval {
        run(@$_);
    };

    if ($@) {
        print "Error: [$@]\n";
    }
}

mattjacob avatar May 03 '17 19:05 mattjacob

I believe that this issue may be resolved in IPC-System-Simple version 1.30, just released to CPAN. Can you confirm?

Thank you very much. Jim Keenan

jkeenan avatar Mar 24 '20 01:03 jkeenan

Sorry, I can’t test because l no longer have access to a Windows machine.

mattjacob avatar Mar 27 '20 16:03 mattjacob

I ran into this error, and after upgrading to the latest version, it appears to work as expected.

Using git instead of svn, test cases 1, 3 and 4 pass.

Test case 2 fails (as expected), presumably due to being both manually and automatically quoted.

mrudat avatar Nov 26 '22 22:11 mrudat