MaxSem has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/325063

Change subject: WIP: return stderr
......................................................................

WIP: return stderr

Change-Id: I5551ae4bbe7b539b528a734aa82198b11f103871
---
M includes/limit.sh
M includes/shell/Shell.php
M includes/shell/ShellCommand.php
3 files changed, 18 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/63/325063/1

diff --git a/includes/limit.sh b/includes/limit.sh
index d71e660..14b04fe 100755
--- a/includes/limit.sh
+++ b/includes/limit.sh
@@ -45,6 +45,7 @@
 MW_MEM_LIMIT=0
 MW_FILE_SIZE_LIMIT=0
 MW_WALL_CLOCK_LIMIT=0
+MW_LOG_STDERR=0
 
 # Override settings
 eval "$2"
diff --git a/includes/shell/Shell.php b/includes/shell/Shell.php
index 4c56f0e..9248ffc 100644
--- a/includes/shell/Shell.php
+++ b/includes/shell/Shell.php
@@ -33,6 +33,7 @@
  *
  *  ... = $command->getExitCode();
  *  ... = $command->getOutput();
+ *  ... = $command->getErrorOutput();
  */
 class Shell {
 
diff --git a/includes/shell/ShellCommand.php b/includes/shell/ShellCommand.php
index a73fba8..d376a54 100644
--- a/includes/shell/ShellCommand.php
+++ b/includes/shell/ShellCommand.php
@@ -44,6 +44,9 @@
        /** @var string|null */
        private $output;
 
+       /** @var string|null */
+       private $stderr;
+
        /** @var int|null */
        private $exitCode;
 
@@ -293,7 +296,10 @@
                                } elseif ( $fd == 1 ) {
                                        // From stdout
                                        $outBuffer .= $block;
-                               } elseif ( $fd == 3 ) {
+                               } elseif ( $fd == 2 ) {
+                                       // From stderr
+                                       $this->stderr .= $block;
+                               } elseif ( $fd == 3 ) {
                                        // From log FD
                                        $logBuffer .= $block;
                                        if ( strpos( $block, "\n" ) !== false ) 
{
@@ -372,4 +378,13 @@
                return $this->output;
        }
 
+       /**
+        * Returns stdout
+        * - If execute() wasn't called yet, null will be returned
+        *
+        * @return string|null
+        */
+       public function getErrorOutput() {
+               return $this->stderr;
+       }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/325063
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5551ae4bbe7b539b528a734aa82198b11f103871
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: MaxSem <maxsem.w...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to