public function __destruct()
{
if (getmypid() === $this->oid) {
$this->kill();
// Will only terminate if the process is still running.
if (null !== $this->stdin) {
$this->stdin->close();
}
if (null !== $this->stdout) {
$this->stdout->close();
}
if (null !== $this->stderr) {
$this->stderr->close();
}
}
}