Fix --disable-readline command-line option does not work, close #34 (#35)

* Fix --disable-readline command-line option does not work, close #34

* add parentheses
This commit is contained in:
Dylan K. Taylor 2016-10-18 14:33:38 +01:00 committed by GitHub
parent 4bc2275fc3
commit ebcc16d283

View File

@ -31,6 +31,8 @@ class CommandReader extends Thread{
public function __construct(){
$this->buffer = new \Threaded;
$opts = getopt("", ["disable-readline"]);
$this->readline = (extension_loaded("readline") and !isset($opts["disable-readline"]));
$this->start();
}
@ -71,14 +73,10 @@ class CommandReader extends Thread{
}
public function run(){
$opts = getopt("", ["disable-readline"]);
if(extension_loaded("readline") and !isset($opts["disable-readline"])){
$this->readline = true;
}else{
if(!$this->readline){
global $stdin;
$stdin = fopen("php://stdin", "r");
stream_set_blocking($stdin, 0);
$this->readline = false;
}
$lastLine = microtime(true);