1
0
mirror of https://github.com/danog/process.git synced 2024-12-04 18:48:13 +01:00

Fix exit code reader

This commit is contained in:
Niklas Keller 2017-09-17 22:07:53 +02:00
parent a5146213ec
commit 13a71c570d

View File

@ -240,15 +240,15 @@ final class SocketConnector {
} }
public function onReadableExitCode($watcher, $socket, Handle $handle) { public function onReadableExitCode($watcher, $socket, Handle $handle) {
$handle->exitCodeWatcher = null;
Loop::cancel($watcher);
$data = \fread($socket, 5); $data = \fread($socket, 5);
if ($data === false || $data === '') { if ($data === false || $data === '') {
return; return;
} }
$handle->exitCodeWatcher = null;
Loop::cancel($watcher);
if (\strlen($data) !== 5) { if (\strlen($data) !== 5) {
$handle->status = ProcessStatus::ENDED; $handle->status = ProcessStatus::ENDED;
$handle->joinDeferred->fail(new ProcessException( $handle->joinDeferred->fail(new ProcessException(