* @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
$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 ) {
$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 );