Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unhandled EPIPE error leading to language server crashes #478

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ArneSchulze
Copy link

The default behaviour of ocaml when receiving a SIGPIPE signal is to terminate the program. Processes opened in Commands.re it can exit prematurely causing an EPIPE error which triggers the SIGPIPE signal leading the language server process to terminate. To circumvent that we tell OCaml to ignore SIGPIPE s.t. the error can be handled when interacting with the channels/file-descriptors in Commands.

@@ -34,7 +34,7 @@ let execFull = (~input=?, ~pwd=?, ~env=Unix.environment(), cmd) => {
| None => ()
| Some(text) => output_string(cmd_in, text)
};
close_out(cmd_in);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

close_out would trigger a Sys_error("Broken pipe") exception now that we ignore the SIGPIPE signal. Instead of catching and handling it, we simply use close_out_noerr which ignores all errors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant