mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-09 21:24:53 +00:00
* Fix --disable-readline command-line option does not work, close #34 * add parentheses
This commit is contained in:
parent
4bc2275fc3
commit
ebcc16d283
@ -31,6 +31,8 @@ class CommandReader extends Thread{
|
|||||||
|
|
||||||
public function __construct(){
|
public function __construct(){
|
||||||
$this->buffer = new \Threaded;
|
$this->buffer = new \Threaded;
|
||||||
|
$opts = getopt("", ["disable-readline"]);
|
||||||
|
$this->readline = (extension_loaded("readline") and !isset($opts["disable-readline"]));
|
||||||
$this->start();
|
$this->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,14 +73,10 @@ class CommandReader extends Thread{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function run(){
|
public function run(){
|
||||||
$opts = getopt("", ["disable-readline"]);
|
if(!$this->readline){
|
||||||
if(extension_loaded("readline") and !isset($opts["disable-readline"])){
|
|
||||||
$this->readline = true;
|
|
||||||
}else{
|
|
||||||
global $stdin;
|
global $stdin;
|
||||||
$stdin = fopen("php://stdin", "r");
|
$stdin = fopen("php://stdin", "r");
|
||||||
stream_set_blocking($stdin, 0);
|
stream_set_blocking($stdin, 0);
|
||||||
$this->readline = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$lastLine = microtime(true);
|
$lastLine = microtime(true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user