(bug 8737) Fix warnings caused by incorrect use of `/dev/null` when piping process...
authorRob Church <robchurch@users.mediawiki.org>
Wed, 15 Aug 2007 21:44:58 +0000 (21:44 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Wed, 15 Aug 2007 21:44:58 +0000 (21:44 +0000)
RELEASE-NOTES
includes/Export.php
includes/GlobalFunctions.php
includes/Parser.php

index bb1fa59..84e6064 100644 (file)
@@ -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 ==
 
index 464f73a..e7fc2c4 100644 (file)
@@ -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 );
        }
 }
index ea23048..67cc1f3 100644 (file)
@@ -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
index d1eb156..9f79d67 100644 (file)
@@ -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);