public function isRunning()
    {
        if ($this->process === null) {
            return false;
        }

        $status = proc_get_status($this->process);
        if ($status && $status['running'] === false && $this->exitcode === null) {
            $this->exitcode = $status['exitcode'];
            // Note that you can not use proc_get_status to determine the PID because proc_open first launches a shell (sh)
            // whose PID is returned!
        }

        return $status && $status['running'];
    }