fix: stop erts
when end of input is reached
#42
Merged
+1
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This ensures that the runtime will shut down if input is closed, eliminating zombie processes that are left when an explicit "shutdown" message isn't sent to the LS.
I elected to use
System.stop/1
instead ofSystem.halt/1
since a careful shutdown of the system seemed preferable.Testing
I tested the change by replacing the
gen_lsp
dependency innext-ls
with my local version, which includes the change, and comparing the behavior of sending an "End of Transmission" event to a runningnext-ls
instance (started withbin/start --stdio
).Before the change
Running
epmd -names | wc -l
after starting the server produced11
(from zombies already on my machine, plus the new server). Without adding theSystem.stop/1
call and sending an EOT using^D
the server does not stop.After the change
Running
epmd -names | wc -l
after starting the server produced11
. Sending an EOT using^D
causes the server to stop, and a subsequent execution ofepmd -names | wc -l
produces10
.