private function reset()
    {
        // it is important that you close any pipes before calling proc_close in order to avoid a deadlock
        if ($this->pipes !== null) {
            foreach ($this->pipes as $pipe) {
                fclose($pipe);
            }
            $this->pipes = null;
        }

        if ($this->process !== null) {
            proc_close($this->process);
            $this->process = null;
        }

        $this->exitcode = null;
    }