◆ __construct()
CommandReader constructor.
45 $this->buffer = new \Threaded;
47 $opts = getopt(
"", [
"disable-readline"]);
48 if((extension_loaded(
"readline") and !isset(
$opts[
"disable-readline"]) and !$this->isPipe(STDIN))){
49 $this->type = self::TYPE_READLINE;
◆ getLine()
Reads a line from console, if available. Returns null if not available
- Returns
- string|null
168 if($this->buffer->count() !== 0){
169 return $this->buffer->shift();
◆ getThreadName()
◆ quit()
60 $wait = microtime(
true) + 0.5;
61 while(microtime(
true) < $wait){
70 $message =
"Thread blocked for unknown reason";
71 if($this->type === self::TYPE_PIPED){
72 $message =
"STDIN is being piped from another location and the pipe is blocked, cannot stop safely";
75 throw new \ThreadException($message);
◆ run()
176 if($this->type !== self::TYPE_READLINE){
180 while(!$this->
shutdown and $this->readLine()) ;
182 if($this->type !== self::TYPE_READLINE){
◆ shutdown()
◆ $buffer
◆ TYPE_PIPED
◆ TYPE_READLINE
◆ TYPE_STREAM
The documentation for this class was generated from the following file:
- src/pocketmine/command/CommandReader.php