public function execute($commandLine)
{
if (is_resource($this->subProcess)) {
$subProcessStatus = proc_get_status($this->subProcess);
if ($subProcessStatus['running'] === false) {
proc_close($this->subProcess);
}
}
if (!is_resource($this->subProcess)) {
list($this->subProcess, $this->pipes) = $this->launchSubProcess();
if ($this->subProcess === false || !is_array($this->pipes)) {
throw new \Exception('Failed launching the shell sub process');
}
}
fwrite($this->pipes[0], $commandLine . "\n");
fflush($this->pipes[0]);
return $this->getSubProcessResponse();
}