- finally (timeout (messageTimeout config * 1^6)
- (runSession' exitServer))
- (cleanupProcess server >> killThread tid)
+ finally (timeout msgTimeoutMs (runSession' exitServer)) $ do
+ -- Make sure to kill the listener first, before closing
+ -- handles etc via cleanupProcess
+ killThread tid
+ -- Give the server some time to exit cleanly
+ timeout msgTimeoutMs (waitForProcess serverProc)
+ cleanupProcess server