public function run()
{
if ($this->readline) {
readline_callback_handler_install("Genisys> ", [$this, "readline_callback"]);
$this->logger->setConsoleCallback("readline_redisplay");
}
while (!$this->shutdown) {
$r = [$this->stdin];
$w = null;
$e = null;
if (stream_select($r, $w, $e, 0, 200000) > 0) {
// PHP on Windows sucks
if (feof($this->stdin)) {
if (Utils::getOS() == "win") {
$this->stdin = fopen("php://stdin", "r");
if (!is_resource($this->stdin)) {
break;
}
} else {
break;
}
}
$this->readLine();
}
}
if ($this->readline) {
$this->logger->setConsoleCallback(null);
readline_callback_handler_remove();
}
}