PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB` _socket = $socket; } /** * Start the client with an prompt and readline history path. * * This method never returns. * * @param string $prompt * @param string $historyFile */ public function start($prompt, $historyFile) { readline_read_history($historyFile); declare(ticks = 1); pcntl_signal(SIGCHLD, SIG_IGN); pcntl_signal(SIGINT, array($this, 'clear'), true); // wait for the worker to finish executing hooks if (fread($this->_socket, 1) != EvalWorker::READY) { throw new \RuntimeException('EvalWorker failed to start'); } $parser = new ShallowParser(); $buf = ''; $lineno = 1; for (;;) { $this->_clear = false; $line = readline( sprintf( '[%d] %s', $lineno, ($buf == '' ? $prompt : str_pad('*> ', strlen($prompt), ' ', STR_PAD_LEFT)) ) ); if ($this->_clear) { $buf = ''; continue; } if (false === $line) { $buf = 'exit(0);'; // ctrl-d acts like exit } if (strlen($line) > 0) { readline_add_history($line); } $buf .= sprintf("%s\n", $line); if ($statements = $parser->statements($buf)) { ++$lineno; $buf = ''; foreach ($statements as $stmt) { if (false === $written = fwrite($this->_socket, $stmt)) { throw new \RuntimeException('Socket error: failed to write data'); } if ($written > 0) { $status = fread($this->_socket, 1); if ($status == EvalWorker::EXITED) { readline_write_history($historyFile); echo "\n"; exit(0); } elseif ($status == EvalWorker::FAILED) { break; } } } } } } /** * Clear the input buffer. */ public function clear() { // FIXME: I'd love to have this send \r to readline so it puts the user on a blank line $this->_clear = true; } }