From 040380321c308c288f89e58d508c05ea17bbd4e2 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sat, 5 Sep 2020 14:23:54 +0100 Subject: [PATCH] WriteConsoleInput can return FALSE when running as servic --- src/Root.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Root.cpp b/src/Root.cpp index 4291c5779..b90a229c9 100644 --- a/src/Root.cpp +++ b/src/Root.cpp @@ -1011,10 +1011,6 @@ void cRoot::TransitionNextState(NextState a_NextState) s_StopEvent.Set(); #ifdef WIN32 - if (g_RunAsService) - { - return; - } DWORD Length; INPUT_RECORD Record @@ -1034,7 +1030,7 @@ void cRoot::TransitionNextState(NextState a_NextState) // Can't kill the input thread since it breaks cin (getline doesn't block / receive input on restart) // Apparently no way to unblock getline apart from CancelIoEx, but xoft wants Windows XP support - // Only thing I can think of for now. - VERIFY(WriteConsoleInput(GetStdHandle(STD_INPUT_HANDLE), &Record, 1, &Length) == TRUE); + // Only thing I can think of for now. Also, ignore the retval since sometimes there's no cin. + WriteConsoleInput(GetStdHandle(STD_INPUT_HANDLE), &Record, 1, &Length); #endif }