Closed uuhan closed 6 years ago
Thanks for reporting!
I can reproduce it and will try to find the actual cause. Seems to be an odd bug since it hasn't happened in previous lts versions (I think).
I finally found that the root cause is: https://github.com/neovimhaskell/nvim-hs/blob/868a86933ecf880eef8f8a092d4fdd90091b4708/library/Neovim/Main.hs#L171 When call by nvim through rpc call, get from stdin ,
_ -> do
hGetSome stdin 10 -- hangs here!
run stdout stdin
But if run nvim-hs from command line, the stdin works fine. Maybe something wrong with stdin of ghc-8.2.2 @saep
Thanks for looking into this!
Adding NoBuffering
to stdout at that location fixes the hanging for me (see #62). Do you mind testing that yourself? If it works for you I'll make a new release on hackage.
@saep Yes, setting NoBuffering to stdout solve the problem. Would you mind tell me why the stdout should be set to NoBuffering with ghc-8.2.2 ?Thanks.
After a bit of digging, I learned that the sinkHandle
function of the conduit-extra library changed it's behavior to not flush on every element anymore. The newer version of the module has a sinkHandleFlush
variant that would have to be used here if stdout uses some kind of buffering.
A proper fix is probably to figure out the version when the behavior changed and add an #ifdef
for compatibility. I suspect that the TCP and UNIX-Socket handles may exhibit the same problem because of this.
edit: typo
When use lts-10.0 snapshot to compile nvim-hs, It is problematic to work. I looked into the logger, found some Error message:
Hangs in this line: https://github.com/neovimhaskell/nvim-hs/blob/868a86933ecf880eef8f8a092d4fdd90091b4708/library/Neovim/RPC/SocketReader.hs#L74