public function getProcess(): Process
    {
        if (count($this->prefix) === 0 && count($this->arguments) === 0) {
            throw new MethodCallException('You must add arguments before calling getProcess()');
        }

        $arguments = array_merge($this->prefix, $this->arguments);
        $command = implode(' ', array_map('escapeshellarg', $arguments));

        if ($this->inheritEnv) {
            $env = array_replace($_SERVER, $this->environment);
        } else {
            $env = $this->environment;
        }

        $process = new Process(
            $command,
            $this->directory,
            $env,
            $this->input,
            $this->timeout,
            $this->stdout,
            $this->stderr
        );

        if ($this->outputDisabled) {
            $process->disableOutput();
        }

        return $process;
    }