mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-12 14:35:35 +00:00
Fixed server not accepting commands after pressing ctrl+D (non-readline)
This commit is contained in:
parent
31f0437c96
commit
ebd3d207e4
@ -116,7 +116,9 @@ class CommandReader extends Thread{
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch($this->type){
|
switch($this->type){
|
||||||
|
/** @noinspection PhpMissingBreakStatementInspection */
|
||||||
case self::TYPE_STREAM:
|
case self::TYPE_STREAM:
|
||||||
|
//stream_select doesn't work on piped streams for some reason
|
||||||
$r = [$stdin];
|
$r = [$stdin];
|
||||||
if(($count = stream_select($r, $w, $e, 0, 200000)) === 0){ //nothing changed in 200000 microseconds
|
if(($count = stream_select($r, $w, $e, 0, 200000)) === 0){ //nothing changed in 200000 microseconds
|
||||||
return true;
|
return true;
|
||||||
@ -124,13 +126,6 @@ class CommandReader extends Thread{
|
|||||||
$this->initStdin();
|
$this->initStdin();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(($raw = fgets($stdin)) !== false){
|
|
||||||
$line = trim($raw);
|
|
||||||
}else{
|
|
||||||
return false; //user pressed ctrl+c?
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
case self::TYPE_PIPED:
|
case self::TYPE_PIPED:
|
||||||
if(($raw = fgets($stdin)) === false){ //broken pipe or EOF
|
if(($raw = fgets($stdin)) === false){ //broken pipe or EOF
|
||||||
$this->initStdin();
|
$this->initStdin();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user