protected function compileRealCommand($commandline, $options, $isLocalExecute = FALSE)
{
$realCommand = "";
$os = php_uname('s');
if ($isLocalExecute && preg_match('/Windows/i', $os)) {
if (isset($options["user"])) {
$realCommand .= 'runas /user:' . $options["user"] . ' ';
}
$realCommand .= 'cmd.exe /C "';
if (isset($options["cwd"])) {
$realCommand .= 'cd ' . $options["cwd"] . ' & ';
}
$realCommand .= str_replace('"', '\\"', $commandline);
$realCommand .= '"';
} else {
if (isset($options["user"])) {
$realCommand .= 'sudo -u' . $options["user"] . ' TERM=dumb ';
}
$realCommand .= 'bash -l -c "';
if (isset($options["cwd"])) {
$realCommand .= 'cd ' . $options["cwd"] . ' && ';
}
$realCommand .= str_replace('"', '\\"', $commandline);
$realCommand .= '"';
}
return $realCommand;
}