diff --git a/src/Command.php b/src/Command.php index 639db1b..6c76296 100644 --- a/src/Command.php +++ b/src/Command.php @@ -20,7 +20,7 @@ private function __construct() * * @throws \Exception */ - public static function exec($command, array $params = array()) + public static function exec($command, array $params = array(), $mergeStdErr=true) { if (empty($command)) { throw new \InvalidArgumentException('Command line is empty'); @@ -28,6 +28,11 @@ public static function exec($command, array $params = array()) $command = self::bindParams($command, $params); + if ($mergeStdErr) { + // Redirect stderr to stdout to include it in $output + $command .= ' 2>&1'; + } + exec($command, $output, $code); if (count($output) === 0) {