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(complete): Don't panic on broken pipe #5453

Closed
wants to merge 1 commit into from

Conversation

yedayak
Copy link

@yedayak yedayak commented Apr 14, 2024

If the completion is piped to another command, for example into less, and that program stops before reading everything, the write fails and the program panics. Make it exit gracefully instead.

If the completion is piped to another command, for example into `less`,
and that program stops before reading everything, the write fails and
the program panics. Make it exit gracefully instead.
Comment on lines +5 to +11
Err(err) if err.kind() == std::io::ErrorKind::BrokenPipe => {
// Is there a better exit code for this?
std::process::exit(1);
}
Err(err) => {
panic!("Failed to write to generated file: {0}", err);
}
Copy link
Member

Choose a reason for hiding this comment

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

Neither case should panic but we should report this error up. Please open an issue on this for us to track for our next breaking change.

Copy link
Author

Choose a reason for hiding this comment

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

Opened #5457.
Should I close this?

Copy link
Member

Choose a reason for hiding this comment

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

The solution will change and some time past, so sure.

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.

None yet

2 participants