public function __construct($disableOutput, $input)
{
$this->disableOutput = (bool) $disableOutput;
if (!$this->disableOutput) {
$this->files = [Process::STDOUT => tempnam(sys_get_temp_dir(), 'sf_proc_stdout'), Process::STDERR => tempnam(sys_get_temp_dir(), 'sf_proc_stderr')];
foreach ($this->files as $offset => $file) {
$this->fileHandles[$offset] = fopen($this->files[$offset], 'rb');
if (false === $this->fileHandles[$offset]) {
throw new \RuntimeException('A temporary file could not be opened to write the process output to, verify that your TEMP environment variable is writable');
}
}
}
if (is_resource($input)) {
$this->input = $input;
} else {
$this->inputBuffer = $input;
}
}