Skip to content

Commit cee2d60

Browse files
committed
Include stderr in $output by default
Redirect stderr to stdout to have it included in output by default.
1 parent a756380 commit cee2d60

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Command.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,19 @@ private function __construct()
2020
*
2121
* @throws \Exception
2222
*/
23-
public static function exec($command, array $params = array())
23+
public static function exec($command, array $params = array(), $mergeStdErr=true)
2424
{
2525
if (empty($command)) {
2626
throw new \InvalidArgumentException('Command line is empty');
2727
}
2828

2929
$command = self::bindParams($command, $params);
3030

31+
if ($mergeStdErr) {
32+
// Redirect stderr to stdout to include it in $output
33+
$command .= ' 2>&1';
34+
}
35+
3136
exec($command, $output, $code);
3237

3338
if (count($output) === 0) {

0 commit comments

Comments
 (0)