function _runScript($script, $log = true, $parameters = '')
{
// Assemble the shell command.
$command = $this->_getScriptPath($script);
if (!empty($parameters)) {
$command .= ' ' . $parameters;
}
// Long running background processes cause
// locking issues on Windows.
$allowLock = true;
if (Core::isWindows() && $script === 'start') {
$allowLock = false;
}
// Configure logging (not supported on Windows
// due to locking issues).
if ($allowLock && $log) {
$logFile = $this->_getLogFileName();
$command .= " 2>&1 >>\"{$logFile}\"";
} else {
if (Core::isWindows()) {
$command .= ' 2>&1 >NUL';
} else {
$command .= ' 2>&1 >/dev/null';
}
}
if (Core::isWindows()) {
$command .= ' <NUL';
} else {
$command .= ' </dev/null';
}
// Execute the command.
if ($allowLock) {
exec($command, $dummy, $returnStatus);
} else {
// Do not lock up PHP on Windows.
pclose(popen($command, 'r'));
$returnStatus = 0;
}
// Return the result.
return $returnStatus === 0;
}