public function start()
    {
        if ($this->isRunning()) {
            throw new LogicException('Process is already running');
        }

        $this->reset();

        $cmd = $this->cmd;
        if (substr($cmd, 0, 4) == 'php ') {
            $php = PHP_BINARY ?: PHP_BINDIR . '/php';
            $cmd = $php . substr($cmd, 3);
        }

        $descriptorspec = [
            0 => ['pipe', 'r'], // STDIN
            1 => ['pipe', 'w'], // STDOUT
            2 => ['pipe', 'w']  // STDERR
        ];

        $options = [
            'suppress_errors' => true,
            'binary_pipes'    => true,
        ];

        $this->process = proc_open($cmd, $descriptorspec, $this->pipes, base_path(), $this->env, $options);

        if (!is_resource($this->process)) {
            throw new RuntimeException('Unable to launch a new process.');
        }
    }