function run(callable $callback = null) {
        if (isset($this->res))
            return null;
        $this->res = proc_open($this->cmd, $this->descriptor_spec, $this->pipes, $this->cwd, $this->env);
        if ($this->res) {
            $this->stdout = new TcpConnection($this->pipes[1]);
            if (is_callable($this->onMessage))
                $this->stdout->onMessage = function ($conn, $data) {
                    ($this->onMessage)($this, $data);
                };
            if (is_callable($this->onClose))
                $this->stdout->onClose = function () {
                    ($this->onClose)($this);
                };
            stream_set_blocking($this->pipes[0], false);
            if (is_callable($callback))
                $callback($this);
            return true;
        }
        unset ($this->res);
        return false;
    }
function run(callable $callback = null) {
        if (isset($this->res))
            return null;
        $this->res = proc_open($this->cmd, $this->descriptor_spec, $this->pipes, $this->cwd, $this->env);
        if ($this->res) {
            $this->stdout = new TcpConnection($this->pipes[1]);
            if (is_callable($this->onMessage))
                $this->stdout->onMessage = function ($conn, $data) {
                    ($this->onMessage)($this, $data);
                };
            if (is_callable($this->onClose))
                $this->stdout->onClose = function () {
                    ($this->onClose)($this);
                };
            stream_set_blocking($this->pipes[0], false);
            if (is_callable($callback))
                $callback($this);
            return true;
        }
        unset ($this->res);
        return false;
    }
function run ( callable $ callback = null ) { if ( isset ( $ this -> res ) ) return null ; $ this -> res = proc_open ( $ this -> cmd , $ this -> descriptor_spec , $ this -> pipes , $ this -> cwd , $ this -> env ) ; if ( $ this -> res ) { $ this -> stdout = new TcpConnection ( $ this -> pipes [ 1 ] ) ; if ( is_callable ( $ this -> onMessage ) ) $ this -> stdout -> onMessage = function ( $ conn , $ data ) { ( $ this -> onMessage ) ( $ this , $ data ) ; } ; if ( is_callable ( $ this -> onClose ) ) $ this -> stdout -> onClose = function ( ) { ( $ this -> onClose ) ( $ this ) ; } ; stream_set_blocking ( $ this -> pipes [ 0 ] , false ) ; if ( is_callable ( $ callback ) ) $ callback ( $ this ) ; return true ; } unset ( $ this -> res ) ; return false ; }
Execute command in a child process.

@param callable $callback
@return bool.
Execute command in a child process .