Open wchristian opened 13 years ago
On 2011.4.18 10:40 PM, wchristian wrote:
This test:
is capture { system @perl5icmd, "-e", "say 'Hello'" }, "Hello\n", "Hello perl5i!";
Generates this command-line call:
C:\Perl\bin\perl.exe -Mperl5i::cmd=perl5i.bat -Ilib, -e, say 'Hello'
Which crashes the whole thing due to Fatal. (May want to add some eval or try to those tests.) This happens because IPC::System::Simple does this on windows:
my $pid = _spawn_or_die($command, "$command @args");
Which means it interpolates the args given into a string and separates them with commas.
Uhh... separates them with commas? How does that work?
In contrast, a core system call generates this kind of command line:
C:\Perl\bin\perl.exe -Mperl5i::cmd=perl5i.bat -Ilib -e "say 'Hello'"
This means that not only does IPC::System::Simple on windows completely butcher the arguments, it also makes us lose the platform-specific quoting.
Can IPC::System::Simple be fixed?
Being faith-based doesn't trump reality. -- Bruce Sterling
Uhh... separates them with commas? How does that work?
Good question, it was a bit late last night, so it didn't occur to me that array interpolation in double-quoted strings doesn't work that way. Apparently $" is set to ',' at line 1074 in Fatal.pm:
local(\$", \$!) = (', ', 0); # TODO - Why do we do this?
I guess preventing that could fix the issue of the commas. Still leaves the lack of system-specific quoting, but i don't think that's as important.
Back to the original question: is this something that can be fixed in IPC::System::Simple? pjf is definitely one of those folks that doesn't know much about Windows, I'm sure it's just an ignorant hack he'd be glad to have fixed.
After some poking, yes, it's likely fixable. I've got the first four command line wrapper tests passing now. Sadly lack of quoting logic is making things hard and will take some more time. I think i may have a pull request for pjf in a few hours.
This test:
Generates this command-line call:
Which crashes the whole thing due to Fatal. (May want to add some eval or try to those tests.) This happens because IPC::System::Simple does this on windows:
Which means it interpolates the args given into a string and separates them with commas.
In contrast, a core system call generates this kind of command line:
This means that not only does IPC::System::Simple on windows completely butcher the arguments, it also makes us lose the platform-specific quoting.