protected final function validate()
    {
        if (isset($this->pid) && !isset($this->resource)) {
            throw new LogicException('Process already closed.', static::ERR_COMPLETED);
        } elseif ($this->running) {
            throw new LogicException('Process already running.', static::ERR_RUNNING);
        }

        $this->command->validate();
    }