on('start', function (Process $process) { $netString = new StreamWrapper( $process->stdout, $process->stdin ); $netString->on('error', function (Exception $e) { $this->emit('error', [$e]); }); $this->rpc()->handle($netString); }); } /** * @return Connection */ public function rpc() { if ($this->rpc === null) { $this->rpc = new Connection(); } return $this->rpc; } }