From: Rob Church Date: Wed, 15 Aug 2007 21:44:58 +0000 (+0000) Subject: (bug 8737) Fix warnings caused by incorrect use of `/dev/null` when piping process... X-Git-Tag: 1.31.0-rc.0~51752 X-Git-Url: http://git.cyclocoop.org/%22%2C%20generer_url_ecrire%28?a=commitdiff_plain;h=2fe74340d8c9194bbf1a154317cef3edede69cd1;p=lhc%2Fweb%2Fwiklou.git (bug 8737) Fix warnings caused by incorrect use of `/dev/null` when piping process error output under Windows --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index bb1fa5935b..84e6064f9b 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -382,6 +382,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 10763) Fix multi-insert logic for PostgreSQL * Fix invalid XHTML when viewing a deleted revision * Fix syntax error in translations of magic words in Romanian language +* (bug 8737) Fix warnings caused by incorrect use of `/dev/null` when piping + process error output under Windows == API changes since 1.10 == diff --git a/includes/Export.php b/includes/Export.php index 464f73a678..e7fc2c46be 100644 --- a/includes/Export.php +++ b/includes/Export.php @@ -558,7 +558,7 @@ class Dump7ZipOutput extends DumpPipeOutput { $command = "7za a -bd -si " . wfEscapeShellArg( $file ); // Suppress annoying useless crap from p7zip // Unfortunately this could suppress real error messages too - $command .= " >/dev/null 2>&1"; + $command .= ' ' . wfGetNull() . ' 2>&1'; parent::DumpPipeOutput( $command ); } } diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index ea2304853a..67cc1f39ee 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -2310,4 +2310,14 @@ function wfLoadExtensionMessages( $extensionName ) { } } - +/** + * Get a platform-independent path to the null file, e.g. + * /dev/null + * + * @return string + */ +function wfGetNull() { + return wfIsWindows() + ? 'NUL' + : '/dev/null'; +} \ No newline at end of file diff --git a/includes/Parser.php b/includes/Parser.php index d1eb156725..9f79d6711e 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -753,7 +753,7 @@ class Parser $descriptorspec = array( 0 => array('pipe', 'r'), 1 => array('pipe', 'w'), - 2 => array('file', '/dev/null', 'a') // FIXME: this line in UNIX-specific, it generates a warning on Windows, because /dev/null is not a valid Windows file. + 2 => array('file', wfGetNull(), 'a') ); $pipes = array(); $process = proc_open("$wgTidyBin -config $wgTidyConf $wgTidyOpts$opts", $descriptorspec, $pipes);