fix: Remove --exit-pause to stop "press any key to exit..." showing when Windows daemon kills server/client

This commit is contained in:
Nick Bolton
2025-02-19 12:31:18 +00:00
parent c9a360a144
commit 09c157f9e1
9 changed files with 5 additions and 34 deletions

View File

@ -129,8 +129,6 @@ int App::run(int argc, char **argv)
LOG((CLOG_CRIT "an unknown error occurred\n"));
}
appUtil().beforeAppExit();
return result;
}

View File

@ -209,16 +209,14 @@ private:
#elif SYSAPI_WIN32
// windows args
#define HELP_SYS_ARGS " [--service <action>] [--relaunch] [--exit-pause]"
#define HELP_SYS_ARGS " [--service <action>] [--relaunch]"
#define HELP_SYS_INFO \
" --service <action> manage the windows service, valid options " \
"are:\n" \
" install/uninstall/start/stop\n" \
" --relaunch persistently relaunches process in current " \
"user \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"
" session (useful for vista and upward).\n"
#endif
#if !defined(WINAPI_LIBEI) && WINAPI_XWINDOWS

View File

@ -28,9 +28,6 @@ public:
{
instance().exitApp(code);
}
virtual void beforeAppExit()
{
}
private:
IApp *m_app;

View File

@ -121,9 +121,7 @@ bool ArgParser::parsePlatformArgs(
)
{
#if WINAPI_MSWINDOWS
if (isArg(i, argc, argv, nullptr, "--exit-pause")) {
argsBase.m_pauseOnExit = true;
} else if (isArg(i, argc, argv, nullptr, "--stop-on-desk-switch")) {
if (isArg(i, argc, argv, nullptr, "--stop-on-desk-switch")) {
argsBase.m_stopOnDeskSwitch = true;
} else {
// option not supported here

View File

@ -91,7 +91,6 @@ public:
#if SYSAPI_WIN32
bool m_debugServiceWait = false;
bool m_pauseOnExit = false;
bool m_stopOnDeskSwitch = false;
#endif

View File

@ -19,7 +19,6 @@ public:
virtual void adoptApp(IApp *app) = 0;
virtual IApp &app() const = 0;
virtual int run(int argc, char **argv) = 0;
virtual void beforeAppExit() = 0;
virtual void startNode() = 0;
virtual std::vector<std::string> getKeyboardLayoutList() = 0;
virtual std::string getCurrentLanguageCode() = 0;

View File

@ -99,17 +99,6 @@ static int foregroundStartupStatic(int argc, char **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)
{
if (!IsWindowsXPSP3OrGreater()) {

View File

@ -35,7 +35,6 @@ public:
void debugServiceWait();
int run(int argc, char **argv) override;
void exitApp(int code) override;
void beforeAppExit() override;
void startNode() override;
std::vector<std::string> getKeyboardLayoutList() override;
std::string getCurrentLanguageCode() override;

View File

@ -207,10 +207,7 @@ TEST(ArgParserTests, parseServerArgs_parses_each_category)
args.m_daemon = false;
char const *argv[] = {
"deskflow", "--help"
#if WINAPI_MSWINDOWS
,
"--exit-pause"
#elif WINAPI_XWINDOWS
#if WINAPI_XWINDOWS
,
"--no-xinitthreads"
#endif
@ -229,10 +226,7 @@ TEST(ArgParserTests, parseClientArgs_parses_single_help)
char const *argv[] = {
kAppId,
"--help"
#if WINAPI_MSWINDOWS
,
"--exit-pause"
#elif WINAPI_XWINDOWS
#if WINAPI_XWINDOWS
,
"--no-xinitthreads"
#endif