fix: Remove --exit-pause to stop "press any key to exit..." showing when Windows daemon kills server/client
This commit is contained in:
parent
c9a360a144
commit
09c157f9e1
9 changed files with 5 additions and 34 deletions
|
|
@ -129,8 +129,6 @@ int App::run(int argc, char **argv)
|
||||||
LOG((CLOG_CRIT "an unknown error occurred\n"));
|
LOG((CLOG_CRIT "an unknown error occurred\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
appUtil().beforeAppExit();
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -209,16 +209,14 @@ private:
|
||||||
#elif SYSAPI_WIN32
|
#elif SYSAPI_WIN32
|
||||||
|
|
||||||
// windows args
|
// windows args
|
||||||
#define HELP_SYS_ARGS " [--service <action>] [--relaunch] [--exit-pause]"
|
#define HELP_SYS_ARGS " [--service <action>] [--relaunch]"
|
||||||
#define HELP_SYS_INFO \
|
#define HELP_SYS_INFO \
|
||||||
" --service <action> manage the windows service, valid options " \
|
" --service <action> manage the windows service, valid options " \
|
||||||
"are:\n" \
|
"are:\n" \
|
||||||
" install/uninstall/start/stop\n" \
|
" install/uninstall/start/stop\n" \
|
||||||
" --relaunch persistently relaunches process in current " \
|
" --relaunch persistently relaunches process in current " \
|
||||||
"user \n" \
|
"user \n" \
|
||||||
" session (useful for vista and upward).\n" \
|
" session (useful for vista and upward).\n"
|
||||||
" --exit-pause wait for key press on exit, can be useful for\n" \
|
|
||||||
" reading error messages that occur on exit.\n"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(WINAPI_LIBEI) && WINAPI_XWINDOWS
|
#if !defined(WINAPI_LIBEI) && WINAPI_XWINDOWS
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,6 @@ public:
|
||||||
{
|
{
|
||||||
instance().exitApp(code);
|
instance().exitApp(code);
|
||||||
}
|
}
|
||||||
virtual void beforeAppExit()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
IApp *m_app;
|
IApp *m_app;
|
||||||
|
|
|
||||||
|
|
@ -121,9 +121,7 @@ bool ArgParser::parsePlatformArgs(
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
#if WINAPI_MSWINDOWS
|
#if WINAPI_MSWINDOWS
|
||||||
if (isArg(i, argc, argv, nullptr, "--exit-pause")) {
|
if (isArg(i, argc, argv, nullptr, "--stop-on-desk-switch")) {
|
||||||
argsBase.m_pauseOnExit = true;
|
|
||||||
} else if (isArg(i, argc, argv, nullptr, "--stop-on-desk-switch")) {
|
|
||||||
argsBase.m_stopOnDeskSwitch = true;
|
argsBase.m_stopOnDeskSwitch = true;
|
||||||
} else {
|
} else {
|
||||||
// option not supported here
|
// option not supported here
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,6 @@ public:
|
||||||
|
|
||||||
#if SYSAPI_WIN32
|
#if SYSAPI_WIN32
|
||||||
bool m_debugServiceWait = false;
|
bool m_debugServiceWait = false;
|
||||||
bool m_pauseOnExit = false;
|
|
||||||
bool m_stopOnDeskSwitch = false;
|
bool m_stopOnDeskSwitch = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ public:
|
||||||
virtual void adoptApp(IApp *app) = 0;
|
virtual void adoptApp(IApp *app) = 0;
|
||||||
virtual IApp &app() const = 0;
|
virtual IApp &app() const = 0;
|
||||||
virtual int run(int argc, char **argv) = 0;
|
virtual int run(int argc, char **argv) = 0;
|
||||||
virtual void beforeAppExit() = 0;
|
|
||||||
virtual void startNode() = 0;
|
virtual void startNode() = 0;
|
||||||
virtual std::vector<std::string> getKeyboardLayoutList() = 0;
|
virtual std::vector<std::string> getKeyboardLayoutList() = 0;
|
||||||
virtual std::string getCurrentLanguageCode() = 0;
|
virtual std::string getCurrentLanguageCode() = 0;
|
||||||
|
|
|
||||||
|
|
@ -99,17 +99,6 @@ static int foregroundStartupStatic(int argc, char **argv)
|
||||||
return AppUtil::instance().app().foregroundStartup(argc, argv);
|
return AppUtil::instance().app().foregroundStartup(argc, argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppUtilWindows::beforeAppExit()
|
|
||||||
{
|
|
||||||
// this can be handy for debugging, since the application is launched in
|
|
||||||
// a new console window, and will normally close on exit (making it so
|
|
||||||
// that we can't see error messages).
|
|
||||||
if (app().argsBase().m_pauseOnExit) {
|
|
||||||
std::cout << std::endl << "press any key to exit..." << std::endl;
|
|
||||||
int c = _getch();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int AppUtilWindows::run(int argc, char **argv)
|
int AppUtilWindows::run(int argc, char **argv)
|
||||||
{
|
{
|
||||||
if (!IsWindowsXPSP3OrGreater()) {
|
if (!IsWindowsXPSP3OrGreater()) {
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,6 @@ public:
|
||||||
void debugServiceWait();
|
void debugServiceWait();
|
||||||
int run(int argc, char **argv) override;
|
int run(int argc, char **argv) override;
|
||||||
void exitApp(int code) override;
|
void exitApp(int code) override;
|
||||||
void beforeAppExit() override;
|
|
||||||
void startNode() override;
|
void startNode() override;
|
||||||
std::vector<std::string> getKeyboardLayoutList() override;
|
std::vector<std::string> getKeyboardLayoutList() override;
|
||||||
std::string getCurrentLanguageCode() override;
|
std::string getCurrentLanguageCode() override;
|
||||||
|
|
|
||||||
|
|
@ -207,10 +207,7 @@ TEST(ArgParserTests, parseServerArgs_parses_each_category)
|
||||||
args.m_daemon = false;
|
args.m_daemon = false;
|
||||||
char const *argv[] = {
|
char const *argv[] = {
|
||||||
"deskflow", "--help"
|
"deskflow", "--help"
|
||||||
#if WINAPI_MSWINDOWS
|
#if WINAPI_XWINDOWS
|
||||||
,
|
|
||||||
"--exit-pause"
|
|
||||||
#elif WINAPI_XWINDOWS
|
|
||||||
,
|
,
|
||||||
"--no-xinitthreads"
|
"--no-xinitthreads"
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -229,10 +226,7 @@ TEST(ArgParserTests, parseClientArgs_parses_single_help)
|
||||||
char const *argv[] = {
|
char const *argv[] = {
|
||||||
kAppId,
|
kAppId,
|
||||||
"--help"
|
"--help"
|
||||||
#if WINAPI_MSWINDOWS
|
#if WINAPI_XWINDOWS
|
||||||
,
|
|
||||||
"--exit-pause"
|
|
||||||
#elif WINAPI_XWINDOWS
|
|
||||||
,
|
,
|
||||||
"--no-xinitthreads"
|
"--no-xinitthreads"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue