Changeset 247808 in webkit
- Timestamp:
- Jul 24, 2019 7:00:37 PM (5 years ago)
- Location:
- trunk/Tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r247804 r247808 1 2019-07-24 Fujii Hironori <Hironori.Fujii@sony.com> 2 3 [webkitperl] runCommand doesn't work in Windows Perl 4 https://bugs.webkit.org/show_bug.cgi?id=199900 5 6 Reviewed by Don Olmstead. 7 8 runCommand was always failing implicit fork by using 'open' with 9 '-|' in Windows Perl. Explicitly specify the command to 'open' not 10 to do the implicit fork. 11 12 There is one more difference between Windows and Unix. 'open' 13 successes on Windows even for non existent command while it fails 14 on Unix. So, return the same error code on Unix as well as 15 Windows. 16 17 * Scripts/VCSUtils.pm: Specified the command to 'open'. 18 * Scripts/webkitperl/VCSUtils_unittest/runCommand.pl: 'echo' 19 command is not available on Windows. Use Perl ($^X) instead. 20 1 21 2019-07-24 Priyanka Agarwal <pagarwal999@apple.com> 2 22 -
trunk/Tools/Scripts/VCSUtils.pm
r235733 r247808 2399 2399 sub runCommand(@) 2400 2400 { 2401 my @args = @_;2402 my $pid = open(CHILD, "-|");2403 if (!defined($pid)) {2404 die "Failed to fork(): $!";2405 }2406 if ($pid) {2407 # Parent process2408 my $childStdout;2409 while (<CHILD>) {2410 $childStdout .= $_;2411 }2412 close(CHILD);2413 my %childOutput;2414 $childOutput{exitStatus} = exitStatus($?);2415 $childOutput{stdout} = $childStdout if $childStdout;2416 return \%childOutput;2417 }2418 # Child process2419 2401 # FIXME: Consider further hardening of this function, including sanitizing the environment. 2420 exec { $args[0] } @args or die "Failed to exec(): $!"; 2402 my $ok = open(CHILD, "-|", @_); 2403 if (!$ok) { 2404 return { exitStatus => 1 }; 2405 } 2406 my $childStdout; 2407 while (<CHILD>) { 2408 $childStdout .= $_; 2409 } 2410 close(CHILD); 2411 my %childOutput; 2412 $childOutput{exitStatus} = exitStatus($?); 2413 $childOutput{stdout} = $childStdout if $childStdout; 2414 return \%childOutput; 2421 2415 } 2422 2416 -
trunk/Tools/Scripts/webkitperl/VCSUtils_unittest/runCommand.pl
r226395 r247808 31 31 use VCSUtils; 32 32 33 use constant ENOENT => 2; # See <errno.h>34 35 33 # The array of test cases. 36 34 my @testCaseHashRefs = ( … … 38 36 # New test 39 37 testName => "Simple", 40 inputArgs => [ "echo", "hello"],38 inputArgs => [$^X, "-e", "print \@ARGV", "hello"], 41 39 expectedReturn => { 42 40 exitStatus => 0, 43 stdout => "hello \n"41 stdout => "hello" 44 42 } 45 43 }, … … 47 45 # New test 48 46 testName => "Multiple commands", 49 inputArgs => [ "echo", "first-command;echo second-command"],47 inputArgs => [$^X, "-e", "print \@ARGV", "first-command;echo second-command"], 50 48 expectedReturn => { 51 49 exitStatus => 0, 52 stdout => "first-command;echo second-command \n"50 stdout => "first-command;echo second-command" 53 51 } 54 52 }, … … 58 56 inputArgs => ["/usr/bin/non-existent-command"], 59 57 expectedReturn => { 60 exitStatus => ENOENT58 exitStatus => 1 61 59 } 62 60 }
Note: See TracChangeset
for help on using the changeset viewer.