ndmitchell / ghcid

Very low feature GHCi based IDE
Other
1.13k stars 114 forks source link

Hidden logs when hot reloading a servant app #329

Closed matsumonkie closed 4 years ago

matsumonkie commented 4 years ago

Hello! First things first, awesome project, I love it and use it daily!!! <3

I'm using ghcid to hot reload a Servant app using this blog post. Everything works perfectly fine except for the logs. when I run Ghcid it starts my application and prints startup messages correctly. But on any following request calls, any putStrLn won't be displayed.

Would you happen to have an idea of what's going on? I'm not even sure the issue is related to Ghcid. I've tried to investigate a bit but so far nothing conclusive.

Note that the putStrLn are working when running ghcid for the tests.

OS: Ubuntu Ghcid: 0.8.7 Command: ghcid --directory=/myDirectory --command "stack ghci myProject " --test "DevelMain.update"

matsumonkie commented 4 years ago

This line https://github.com/ndmitchell/ghcid/blob/master/src/Language/Haskell/Ghcid.hs#L64 shows that Ghci subprocesses are created and their std_out are bound to a pipe instead of inherited from their father.

I'm not too sure yet why this is done but I assume this is related to the consume function https://github.com/ndmitchell/ghcid/blob/master/src/Language/Haskell/Ghcid.hs#L101

I will keep on investigating but I'd love to have your input on this :-)

matsumonkie commented 4 years ago

Oops... nevermind, the issue doesn't come from ghcid but from the script that hot reloads the app https://github.com/parsonsmatt/servant-persistent/blob/ffd619f2ebd3d2b6b1b3842e4026e32edbbd57d0/src/DevelMain.hs#L61

Sorry for the trouble :-S