r24838 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r24837‎ | r24838 | r24839 >
Date:21:44, 15 August 2007
Author:robchurch
Status:old
Tags:
Comment:
(bug 8737) Fix warnings caused by incorrect use of `/dev/null` when piping process error output under Windows
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/Export.php (modified) (history)
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)
  • /trunk/phase3/includes/Parser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/GlobalFunctions.php
@@ -2310,4 +2310,14 @@
23112311 }
23122312 }
23132313
2314 -
 2314+/**
 2315+ * Get a platform-independent path to the null file, e.g.
 2316+ * /dev/null
 2317+ *
 2318+ * @return string
 2319+ */
 2320+function wfGetNull() {
 2321+ return wfIsWindows()
 2322+ ? 'NUL'
 2323+ : '/dev/null';
 2324+}
\ No newline at end of file
Index: trunk/phase3/includes/Parser.php
@@ -753,7 +753,7 @@
754754 $descriptorspec = array(
755755 0 => array('pipe', 'r'),
756756 1 => array('pipe', 'w'),
757 - 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.
 757+ 2 => array('file', wfGetNull(), 'a')
758758 );
759759 $pipes = array();
760760 $process = proc_open("$wgTidyBin -config $wgTidyConf $wgTidyOpts$opts", $descriptorspec, $pipes);
Index: trunk/phase3/includes/Export.php
@@ -558,7 +558,7 @@
559559 $command = "7za a -bd -si " . wfEscapeShellArg( $file );
560560 // Suppress annoying useless crap from p7zip
561561 // Unfortunately this could suppress real error messages too
562 - $command .= " >/dev/null 2>&1";
 562+ $command .= ' ' . wfGetNull() . ' 2>&1';
563563 parent::DumpPipeOutput( $command );
564564 }
565565 }
Index: trunk/phase3/RELEASE-NOTES
@@ -382,6 +382,8 @@
383383 * (bug 10763) Fix multi-insert logic for PostgreSQL
384384 * Fix invalid XHTML when viewing a deleted revision
385385 * Fix syntax error in translations of magic words in Romanian language
 386+* (bug 8737) Fix warnings caused by incorrect use of `/dev/null` when piping
 387+ process error output under Windows
386388
387389 == API changes since 1.10 ==
388390

Follow-up revisions

RevisionCommit summaryAuthorDate
r24866Merged revisions 24755-24865 via svnmerge from...david23:08, 16 August 2007
r24875fix regression from r24838 -- lost a '>' char for redirecting 7za output to nullbrion14:39, 17 August 2007
r25016Merged revisions 24866-25015 via svnmerge from...david23:06, 21 August 2007

Status & tagging log