in reply to Weird message from IPC::Run::run

It could be due to the arguments that come after '-w'.

I'm skeptical about the escape-quoting mechanism in the source:
my $process; my $cmd_line = join " ", map { ( my $s = $_ ) =~ s/"/"""/g; $s = qq{"$s"} if /[\"\s]/; $s; } @$cmd; _debug "cmd line: ", $cmd_line if _debugging; Win32::Process::Create( $process, $cmd->[0], $cmd_line, 1, ## Inherit handles NORMAL_PRIORITY_CLASS, ".", ) or croak "$!: Win32::Process::Create()";

Perhaps this may be better to make it seem more Unix-like:
my $cmd_line = join " ", map { (my $s = $_) =~ s/([\\"])/\\$1/g; qq{"$s"}; } @$cmd;

BTW, thanks for writing Windows quoting.

Replies are listed 'Best First'.
Re^2: Weird message from IPC::Run::run
by rovf (Priest) on Mar 20, 2009 at 08:19 UTC
    It could be due to the arguments that come after '-w'

    If this would be the reason, I think it should fail every time, and not run well most of the time. There are actually two arguments after the -w: The first is a Windows UNC path, and the second is just a word. Aside from the path separators, only letters and digits are used in the arguments. Nothing dangerous about quoting anyway.

    The error message seems to be generated pretty late. I am using redirection, i.e.

    run([....],'>output','2>error');
    and the error message of run() is found in the output file, which means that it is generated after run() has set up the redirection. I don't know whether this gives us some clue though....

    -- 
    Ronald Fischer <ynnor@mm.st>