private function spawn()
{
$cmd = $this->workerCommand;
$fds = [["pipe", "r"], ["pipe", "w"], ["pipe", "w"]];
$options = ["bypass_shell" => true];
if (!($procHandle = \proc_open($cmd, $fds, $pipes, null, null, $options))) {
return new Failure(new \RuntimeException("Failed spawning worker process"));
}
foreach ($pipes as $pipe) {
@fclose($pipe);
}
$this->processes[] = $procHandle;
return ($this->spawnPromisors[] = new Deferred())->promise();
}