- fixed: process should shut down when command is empty.
- fixed: when command was empty quotes ("") daemon crashed.
This commit is contained in:
parent
79ab428454
commit
499cd47e63
|
@ -175,6 +175,7 @@ CMSWindowsRelauncher::mainLoop(void*)
|
||||||
// anything yet, so don't show it as a warning, only show it as
|
// anything yet, so don't show it as a warning, only show it as
|
||||||
// debug to devs to let them know why nothing happened.
|
// debug to devs to let them know why nothing happened.
|
||||||
LOG((CLOG_DEBUG "nothing to launch, no command specified."));
|
LOG((CLOG_DEBUG "nothing to launch, no command specified."));
|
||||||
|
shutdownExistingProcesses();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,7 +232,7 @@ CMSWindowsRelauncher::isProcessRunning()
|
||||||
GetExitCodeProcess(m_processInfo.hProcess, &exitCode);
|
GetExitCodeProcess(m_processInfo.hProcess, &exitCode);
|
||||||
running = (exitCode == STILL_ACTIVE);
|
running = (exitCode == STILL_ACTIVE);
|
||||||
|
|
||||||
if (!running) {
|
if (!running && !m_command.empty()) {
|
||||||
m_failures++;
|
m_failures++;
|
||||||
LOG((CLOG_INFO
|
LOG((CLOG_INFO
|
||||||
"detected application not running, pid=%d, failures=%d",
|
"detected application not running, pid=%d, failures=%d",
|
||||||
|
|
|
@ -298,25 +298,36 @@ CDaemonApp::handleIpcMessage(const CEvent& e, void*)
|
||||||
case kIpcCommand: {
|
case kIpcCommand: {
|
||||||
CIpcCommandMessage* cm = static_cast<CIpcCommandMessage*>(m);
|
CIpcCommandMessage* cm = static_cast<CIpcCommandMessage*>(m);
|
||||||
CString command = cm->command();
|
CString command = cm->command();
|
||||||
LOG((CLOG_DEBUG "new command, elevate=%d command=%s", cm->elevate(), command.c_str()));
|
|
||||||
|
|
||||||
CString debugArg("--debug");
|
// if empty quotes, clear.
|
||||||
UInt32 debugArgPos = static_cast<UInt32>(command.find(debugArg));
|
if (command == "\"\"") {
|
||||||
if (debugArgPos != CString::npos) {
|
command.clear();
|
||||||
UInt32 from = debugArgPos + static_cast<UInt32>(debugArg.size()) + 1;
|
}
|
||||||
UInt32 nextSpace = static_cast<UInt32>(command.find(" ", from));
|
|
||||||
CString logLevel(command.substr(from, nextSpace - from));
|
if (!command.empty()) {
|
||||||
|
LOG((CLOG_DEBUG "new command, elevate=%d command=%s", cm->elevate(), command.c_str()));
|
||||||
|
|
||||||
|
CString debugArg("--debug");
|
||||||
|
UInt32 debugArgPos = static_cast<UInt32>(command.find(debugArg));
|
||||||
|
if (debugArgPos != CString::npos) {
|
||||||
|
UInt32 from = debugArgPos + static_cast<UInt32>(debugArg.size()) + 1;
|
||||||
|
UInt32 nextSpace = static_cast<UInt32>(command.find(" ", from));
|
||||||
|
CString logLevel(command.substr(from, nextSpace - from));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// change log level based on that in the command string
|
// change log level based on that in the command string
|
||||||
// and change to that log level now.
|
// and change to that log level now.
|
||||||
ARCH->setting("LogLevel", logLevel);
|
ARCH->setting("LogLevel", logLevel);
|
||||||
CLOG->setFilter(logLevel.c_str());
|
CLOG->setFilter(logLevel.c_str());
|
||||||
}
|
}
|
||||||
catch (XArch& e) {
|
catch (XArch& e) {
|
||||||
LOG((CLOG_ERR "failed to save LogLevel setting, %s", e.what().c_str()));
|
LOG((CLOG_ERR "failed to save LogLevel setting, %s", e.what().c_str()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
LOG((CLOG_DEBUG "empty command, elevate=%d", cm->elevate()));
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// store command in system settings. this is used when the daemon
|
// store command in system settings. this is used when the daemon
|
||||||
|
|
Loading…
Reference in New Issue