public function start()
    {
        $this->spec = [
            // 0 => ['pipe', 'w+'],
          1 => fopen('php://temp/maxmemory:' . (1024 * 1024), 'w+'),
          2 => fopen('php://temp/maxmemory:' . (1024 * 1024), 'w+'),
        ];

        if ('\\' === DIRECTORY_SEPARATOR) {
            $this->options = array_merge(['bypass_shell' => true], (array)$this->options);
        }

        /** @var Error $error */
        $error = null;

        set_error_handler(function ($errno, $errstr, $errfile, $errline) use (&$error) {
            $error = Error::fromError($errno, $errstr, $errfile, $errline);
        });

        $this->proc = proc_open($this->cmd, $this->spec, $this->pipes, $this->cwd, null, $this->options);

        restore_error_handler();

        $this->pipes = $this->spec;

        if (!is_null($error)) {
            throw new Exception('Can\'t create process', 0, new Exception($error->message, $error->code));
        }
        if (!$this->isRunning()) {
            throw new Exception('Can\'t create process');
        }

        return $this;
    }
public function start()
    {
        $this->spec = [
            // 0 => ['pipe', 'w+'],
          1 => fopen('php://temp/maxmemory:' . (1024 * 1024), 'w+'),
          2 => fopen('php://temp/maxmemory:' . (1024 * 1024), 'w+'),
        ];

        if ('\\' === DIRECTORY_SEPARATOR) {
            $this->options = array_merge(['bypass_shell' => true], (array)$this->options);
        }

        /** @var Error $error */
        $error = null;

        set_error_handler(function ($errno, $errstr, $errfile, $errline) use (&$error) {
            $error = Error::fromError($errno, $errstr, $errfile, $errline);
        });

        $this->proc = proc_open($this->cmd, $this->spec, $this->pipes, $this->cwd, null, $this->options);

        restore_error_handler();

        $this->pipes = $this->spec;

        if (!is_null($error)) {
            throw new Exception('Can\'t create process', 0, new Exception($error->message, $error->code));
        }
        if (!$this->isRunning()) {
            throw new Exception('Can\'t create process');
        }

        return $this;
    }
public function start ( ) { $ this -> spec = [ // 0 => ['pipe', 'w+'], 1 => fopen ( 'php://temp/maxmemory:' . ( 1024 * 1024 ) , 'w+' ) , 2 => fopen ( 'php://temp/maxmemory:' . ( 1024 * 1024 ) , 'w+' ) , ] ; if ( '\\' === DIRECTORY_SEPARATOR ) { $ this -> options = array_merge ( [ 'bypass_shell' => true ] , ( array ) $ this -> options ) ; } /** @var Error $error */ $ error = null ; set_error_handler ( function ( $ errno , $ errstr , $ errfile , $ errline ) use ( & $ error ) { $ error = Error :: fromError ( $ errno , $ errstr , $ errfile , $ errline ) ; } ) ; $ this -> proc = proc_open ( $ this -> cmd , $ this -> spec , $ this -> pipes , $ this -> cwd , null , $ this -> options ) ; restore_error_handler ( ) ; $ this -> pipes = $ this -> spec ; if ( ! is_null ( $ error ) ) { throw new Exception ( 'Can\'t create process' , 0 , new Exception ( $ error -> message , $ error -> code ) ) ; } if ( ! $ this -> isRunning ( ) ) { throw new Exception ( 'Can\'t create process' ) ; } return $ this ; }
Start a process

@return $this
@throws Exception
Start a process