From ed282d6a815b9ed2100f1dbf5ea600527f2568f1 Mon Sep 17 00:00:00 2001 From: ace411 Date: Mon, 4 Aug 2025 23:25:26 +0300 Subject: [PATCH 1/2] feat: propagate process failure via STDERR --- src/internal/proc.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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) + ); } ); From 178d98ebc364f930c0da88523a4ff53788bea56e Mon Sep 17 00:00:00 2001 From: ace411 Date: Mon, 4 Aug 2025 23:31:59 +0300 Subject: [PATCH 2/2] fix: fix failing test --- tests/Internal/InternalTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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"], ]; }