ConsoleReaderChildProcess: die voluntarily if connection to server process is closed

this happens if the parent process is killed via SIGINT, because its stdin will be closed, interrupting a blocking read. This might also happen if the user pressed CTRL+D, so we don't die unless end of socket stream was also detected.

closes #4335
This commit is contained in:
Dylan T 2021-07-26 15:07:39 +01:00
parent 1afda04620
commit c7bb77e24a

View File

@ -41,7 +41,7 @@ if($socket === false){
throw new \RuntimeException("Failed to connect to server process");
}
$consoleReader = new ConsoleReader();
while(true){
while(!feof($socket)){
$line = $consoleReader->readLine();
if($line !== null){
fwrite($socket, $line . "\n");