Repository navigation
eval: feed stdin from an empty temporary file to avoid hangs - #4963
Conversation
532cf28 to
91bdc88
Compare
6b87429 to
1928f7a
Compare
|
Somehow times out. Any ideas? |
a5cde07 to
161cb5f
Compare
e6635c5 to
2a37df0
Compare
|
The cause of the timeout was a deadlock.
The reason was to clone the In detail, the original |
59ffbb9 to
33dc7bd
Compare
VeryMilkyJoe
left a comment
There was a problem hiding this comment.
Just a little nit about documentation.
Thank you for this, I think it's really cool that you are working on the eval plugin!
| | LogEvalFailedSettingInteractivePrintFunction | ||
| | LogEvalCaptureStdHandles CapturePhase String | ||
|
|
||
| -- | Step of redirecting the interpreted standard handles around a statement. |
There was a problem hiding this comment.
I don't really understand what this means, specifically what "around a statement".
There was a problem hiding this comment.
Yea.. internals of the evil plugin; it should be explained in a better way.
I have updated the documentation. A opy of the new version is:
-- | Phases required to capture standard handles
--
-- Phases of the @eval@ plugin:
-- - fire up a GHCi session
-- - inject code into the GHCi session
-- - run the code
-- - capture the output
--
-- The code injected into the GHCi session contains a setup and a teardown
-- preparing and closing the involved handels, see 'captureSetup' and
-- 'captureTeardown'.The server read JSON-RPC messages from `stdin`, which all code in the server process shares. An expression evaluated by the eval plugin could consume LSP messages (`getLine`), or block on the handle while the server's reader thread holds it. As for `stdout`, read LSP messages from a duplicate of `stdin`, and point `stdin` at an empty pipe, so reads see end of file. The in-process test harness, which supplies its own input handle, does the same. Also log failures of the eval plugin's capture setup and teardown, and test capturing `stdout` and `stderr` repeatedly, as well as reading `stdin`.
d6b9f60 to
06d3b13
Compare
VeryMilkyJoe
left a comment
There was a problem hiding this comment.
Thank you, just a typo then we can merge!
06d3b13 to
fc76c71
Compare
|
🎉 thanks for the review @VeryMilkyJoe ! |
This is a followup of #4726.
Feed
stdinfrom an empty file.The test explains the behavior:
@xsebek
Fixes #2913.