From 13a71c570d5094095fd0d1984b61a0e09c142fc7 Mon Sep 17 00:00:00 2001 From: Niklas Keller Date: Sun, 17 Sep 2017 22:07:53 +0200 Subject: [PATCH] Fix exit code reader --- lib/Internal/Windows/SocketConnector.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Internal/Windows/SocketConnector.php b/lib/Internal/Windows/SocketConnector.php index 9a18d22..bdd975d 100644 --- a/lib/Internal/Windows/SocketConnector.php +++ b/lib/Internal/Windows/SocketConnector.php @@ -240,15 +240,15 @@ final class SocketConnector { } public function onReadableExitCode($watcher, $socket, Handle $handle) { - $handle->exitCodeWatcher = null; - Loop::cancel($watcher); - $data = \fread($socket, 5); if ($data === false || $data === '') { return; } + $handle->exitCodeWatcher = null; + Loop::cancel($watcher); + if (\strlen($data) !== 5) { $handle->status = ProcessStatus::ENDED; $handle->joinDeferred->fail(new ProcessException(