Skip to content

Commit

Permalink
Improved CommandReader
Browse files Browse the repository at this point in the history
  • Loading branch information
PeratX committed Apr 25, 2016
1 parent f0abd95 commit dfcb966
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/pocketmine/command/CommandReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use pocketmine\Thread;
use pocketmine\ThreadManager;
use pocketmine\utils\MainLogger;
use pocketmine\utils\Utils;

class CommandReader extends Thread{
private $readline;
Expand Down Expand Up @@ -84,11 +85,10 @@ public function getLine(){

public function quit(){
$this->shutdown();
if (strncasecmp(PHP_OS, 'WIN', 3) == 0) {
if(Utils::getOS() != "win"){
// Windows sucks. Don't use that.
parent::kill();
parent::quit();
}
parent::quit();
}

public function run(){
Expand All @@ -103,14 +103,15 @@ public function run(){
$e = null;
if(stream_select($r, $w, $e, 0, 200000) > 0){
if(feof($this->stdin)){
$this->buffer[] = "stop";
$this->shutdown();
/*$this->buffer[] = "stop";
$this->shutdown();*/
$this->stdin = fopen("php://stdin", "r");//Unexpected stdin close
break;
}
$this->readLine();
}
}

if($this->readline){
$this->logger->setConsoleCallback(null);
readline_callback_handler_remove();
Expand Down

0 comments on commit dfcb966

Please sign in to comment.