Return stderr from Shell\Command
[lhc/web/wiklou.git] / includes / shell / Result.php
index c1429df..1e18210 100644 (file)
@@ -32,13 +32,17 @@ class Result {
        /** @var string */
        private $stdout;
 
+       /** @var string|null */
+       private $stderr;
+
        /**
         * @param int $exitCode
         * @param string $stdout
         */
-       public function __construct( $exitCode, $stdout ) {
+       public function __construct( $exitCode, $stdout, $stderr = null ) {
                $this->exitCode = $exitCode;
                $this->stdout = $stdout;
+               $this->stderr = $stderr;
        }
 
        /**
@@ -58,4 +62,14 @@ class Result {
        public function getStdout() {
                return $this->stdout;
        }
+
+       /**
+        * Returns stderr of the process or null if the Command was configured to add stderr to stdout
+        * with includeStderr( true )
+        *
+        * @return string|null
+        */
+       public function getStderr() {
+               return $this->stderr;
+       }
 }