Fixed issue 505

This commit is contained in:
Nick Bolton 2010-06-05 12:52:30 +00:00
parent a8df07a362
commit f83e91f304
3 changed files with 22 additions and 0 deletions

View File

@ -76,6 +76,10 @@ CArchAppUtilWindows::parseArg(const int& argc, const char* const* argv, int& i)
} }
app().m_bye(kExitSuccess); app().m_bye(kExitSuccess);
} }
else if (app().isArg(i, argc, argv, NULL, "--debug-service-wait")) {
app().argsBase().m_debugServiceWait = true;
}
else { else {
// option not supported here // option not supported here
return false; return false;
@ -197,6 +201,20 @@ int
CArchAppUtilWindows::daemonNTMainLoop(int argc, const char** argv) CArchAppUtilWindows::daemonNTMainLoop(int argc, const char** argv)
{ {
app().parseArgs(argc, argv); app().parseArgs(argc, argv);
if (app().argsBase().m_debugServiceWait)
{
while(true)
{
// this code is only executed when the process is launched via the
// windows service controller (and --debug-service-wait arg is
// used). to debug, set a breakpoint on this line so that
// execution is delayed until the debugger is attached.
ARCH->sleep(1);
LOG((CLOG_INFO "waiting for debugger to attach"));
}
}
app().argsBase().m_backend = false; app().argsBase().m_backend = false;
app().loadConfig(); app().loadConfig();
return CArchMiscWindows::runDaemon(mainLoopStatic); return CArchMiscWindows::runDaemon(mainLoopStatic);

View File

@ -48,6 +48,7 @@ CApp::~CApp()
CApp::CArgsBase::CArgsBase() : CApp::CArgsBase::CArgsBase() :
#if SYSAPI_WIN32 #if SYSAPI_WIN32
m_daemon(false), // daemon mode not supported on windows (use --service) m_daemon(false), // daemon mode not supported on windows (use --service)
m_debugServiceWait(false),
#else #else
m_daemon(true), // backward compatibility for unix (daemon by default) m_daemon(true), // backward compatibility for unix (daemon by default)
#endif #endif

View File

@ -39,6 +39,9 @@ public:
const char* m_logFile; const char* m_logFile;
const char* m_display; const char* m_display;
CString m_name; CString m_name;
#if SYSAPI_WIN32
bool m_debugServiceWait;
#endif
}; };
CApp(CArgsBase* args); CApp(CArgsBase* args);