protected function launchSubProcess()
{
$systemCommand = 'FLOW_ROOTPATH=' . FLOW_PATH_ROOT . ' FLOW_PATH_TEMPORARY_BASE=' . escapeshellarg(FLOW_PATH_TEMPORARY_BASE) . ' FLOW_CONTEXT=' . (string) $this->context . ' ' . PHP_BINDIR . '/php -c ' . php_ini_loaded_file() . ' ' . FLOW_PATH_FLOW . 'Scripts/flow.php' . ' --start-slave';
$descriptorSpecification = [['pipe', 'r'], ['pipe', 'w'], ['pipe', 'a']];
$this->subProcess = proc_open($systemCommand, $descriptorSpecification, $this->pipes);
if (!is_resource($this->subProcess)) {
throw new \RuntimeException('Could not execute sub process.');
}
$read = [$this->pipes[1]];
$write = null;
$except = null;
$readTimeout = 30;
stream_select($read, $write, $except, $readTimeout);
$subProcessStatus = proc_get_status($this->subProcess);
return $subProcessStatus['running'] === true ? [$this->subProcess, $this->pipes] : false;
}