From 6bc3af345c1f4b32df656b4b6a5ddac5d440b7af Mon Sep 17 00:00:00 2001 From: Javier Sagredo Date: Sun, 1 Sep 2024 23:48:00 +0200 Subject: [PATCH] WIP: Non-zero windows exit code --- cabal-testsuite/src/Test/Cabal/Server.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cabal-testsuite/src/Test/Cabal/Server.hs b/cabal-testsuite/src/Test/Cabal/Server.hs index 76387a2bae1..ac1ab754fa6 100644 --- a/cabal-testsuite/src/Test/Cabal/Server.hs +++ b/cabal-testsuite/src/Test/Cabal/Server.hs @@ -39,6 +39,7 @@ import Foreign.C.Error (Errno (..), ePIPE) import qualified GHC.IO.Exception as GHC +import Distribution.System import Distribution.Verbosity import System.Process.Internals @@ -306,7 +307,13 @@ stopServer s = do -- will actually die, and then hClose will fail because -- the ":quit" command was buffered up but never got -- flushed. - interruptProcessGroupOf (serverProcessHandle s) + -- + -- On the "happy path" which is this soft killer, interrupting the + -- process on Windows would be an actual abortion of the program, + -- with a non-zero exit-code. Not doing this on Windows ensures that + -- the "happy path" if chosen, would exit with exit-code zero. + when (buildOS /= Windows) $ + interruptProcessGroupOf (serverProcessHandle s) log ServerMeta s $ "Waiting..." -- Close input BEFORE waiting, close output AFTER waiting.