X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=tests%2Fparser%2FParserTestPrinter.php;h=34f8cd50d3684a27bc7d19b60fd9bd41db6e2ac7;hp=94d226c1d518c0869d5fe74229ded334c23e4eb7;hb=dfec83932fd38a9086eb5a2e212889ad00f35b0e;hpb=6f7e982df6479e27c3b17f2deda8404ef55f50e6 diff --git a/tests/parser/ParserTestPrinter.php b/tests/parser/ParserTestPrinter.php index 94d226c1d5..34f8cd50d3 100644 --- a/tests/parser/ParserTestPrinter.php +++ b/tests/parser/ParserTestPrinter.php @@ -19,6 +19,8 @@ * @ingroup Testing */ +use MediaWiki\Shell\Shell; + /** * This is a TestRecorder responsible for printing information about progress, * success and failure to the console. It is specific to the parserTests.php @@ -166,19 +168,12 @@ class ParserTestPrinter extends TestRecorder { $output = strtr( $output, $pairs ); } - # Windows, or at least the fc utility, is retarded - $slash = wfIsWindows() ? '\\' : '/'; - $prefix = wfTempDir() . "{$slash}mwParser-" . mt_rand(); - - $infile = "$prefix-$inFileTail"; + $infile = tempnam( wfTempDir(), "mwParser-$inFileTail" ); $this->dumpToFile( $input, $infile ); - $outfile = "$prefix-$outFileTail"; + $outfile = tempnam( wfTempDir(), "mwParser-$outFileTail" ); $this->dumpToFile( $output, $outfile ); - $shellInfile = wfEscapeShellArg( $infile ); - $shellOutfile = wfEscapeShellArg( $outfile ); - global $wgDiff3; // we assume that people with diff3 also have usual diff if ( $this->useDwdiff ) { @@ -187,7 +182,11 @@ class ParserTestPrinter extends TestRecorder { $shellCommand = ( wfIsWindows() && !$wgDiff3 ) ? 'fc' : 'diff -au'; } - $diff = wfShellExec( "$shellCommand $shellInfile $shellOutfile" ); + $result = Shell::command() + ->unsafeParams( $shellCommand ) + ->params( $infile, $outfile ) + ->execute(); + $diff = $result->getStdout(); unlink( $infile ); unlink( $outfile );