garydgregory commented on code in PR #307:
URL: https://github.com/apache/commons-daemon/pull/307#discussion_r2829971310


##########
src/native/windows/apps/prunsrv/prunsrv.c:
##########
@@ -1999,8 +1999,17 @@ void WINAPI serviceMain(DWORD argc, LPTSTR *argv)
         apxLogWrite(APXLOG_MARK_DEBUG "Waiting %d milliseconds for all threads 
to exit.", timeout);
         reportServiceStatus(SERVICE_STOP_PENDING, NO_ERROR, 
ONE_MINUTE_AS_MILLIS);
         if (!apxDestroyJvm(timeout)) {
-            /* if we are not using JAVA apxDestroyJvm does nothing, check the 
chid processes in case they hang */
+            /* if we are not using JAVA apxDestroyJvm does nothing */
             apxLogWrite(APXLOG_MARK_DEBUG "apxDestroyJvm did nothing or 
failed");
+            /* detach service process from console */
+            if (GetConsoleWindow() != NULL) {
+                apxLogWrite(APXLOG_MARK_DEBUG "Detaching service from 
console");
+                if (FreeConsole())
+                    apxLogWrite(APXLOG_MARK_DEBUG "Service detached from 
console");
+                else
+                    apxLogWrite(APXLOG_MARK_DEBUG "Failed to detach service 
from console");

Review Comment:
   We should log what the actual error is here.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to