diff --git a/src/internal/proc.php b/src/internal/proc.php index 4acf640..5cbadd9 100644 --- a/src/internal/proc.php +++ b/src/internal/proc.php @@ -53,10 +53,12 @@ function proc(string $process, ?LoopInterface $loop = null): PromiseInterface return new Promise( function (callable $resolve, callable $reject) use (&$data, $proc) { - $proc->stdout->on( - 'error', - function (\Throwable $err) use ($reject) { - $reject($err); + $proc->stderr->on( + 'data', + function (string $err) use ($reject) { + $reject( + new \Exception($err) + ); } ); diff --git a/tests/Internal/InternalTest.php b/tests/Internal/InternalTest.php index 54fef58..c560944 100644 --- a/tests/Internal/InternalTest.php +++ b/tests/Internal/InternalTest.php @@ -19,7 +19,7 @@ public function procProvider(): array // php commandline process [['php -r \'echo "foo";\''], 'foo'], // invalid input - [['kat --foo'], ''], + [['kat --foo'], "sh: 1: kat: not found\n"], ]; }