Fixed server not accepting commands after pressing ctrl+D (non-readline)

This commit is contained in:
Dylan K. Taylor 2017-12-07 13:42:34 +00:00
parent 31f0437c96
commit ebd3d207e4

View File

@ -116,7 +116,9 @@ class CommandReader extends Thread{
}
switch($this->type){
/** @noinspection PhpMissingBreakStatementInspection */
case self::TYPE_STREAM:
//stream_select doesn't work on piped streams for some reason
$r = [$stdin];
if(($count = stream_select($r, $w, $e, 0, 200000)) === 0){ //nothing changed in 200000 microseconds
return true;
@ -124,13 +126,6 @@ class CommandReader extends Thread{
$this->initStdin();
}
if(($raw = fgets($stdin)) !== false){
$line = trim($raw);
}else{
return false; //user pressed ctrl+c?
}
break;
case self::TYPE_PIPED:
if(($raw = fgets($stdin)) === false){ //broken pipe or EOF
$this->initStdin();