aesiniath / unbeliever

Opinionated Haskell Interoperability
https://hackage.haskell.org/package/unbeliever
MIT License
33 stars 11 forks source link

Fix spurious timeout when using execute in GHCi #178

Closed istathar closed 1 year ago

istathar commented 1 year ago

You can use execute or executeWith in GHCi, but after 10 seconds we were getting an message about a timeout and an exit code. This was of course the 10 second timeout used to terminate the program in the event that graceful shutdown of the output and telemetry channels fails. Strangely, though, it was coming out only in GHCi.

Inspection showed the reason, pretty silly; a running process that exits eliminates the timer thread but in GHCi it runs to completion.

Simple fix: explicitly end the timeout thread before exiting.