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

Properly exit when receiving SIGINT/SIGTERM/SIGHUP #377

Merged
merged 1 commit into from
Nov 27, 2022
Merged

Conversation

reese
Copy link
Collaborator

@reese reese commented Nov 26, 2022

Resolves #322

Currently, rubyfmt has no concept of signal handling, and while it's theoretically so fast it shouldn't matter, there are times where it can hang or run for very long times (e.g. running in debug mode on gigantic files) where users may want to kill it. This PR uses the ctrlc crate to just exit when receiving any of SIGINT/SIGTERM/SIGHUP from the OS.

There may be more graceful ways to handle this (like setting a variable and then checking it at certain places in the program), but just exiting gets us 99% of the value here with far less invasive changes.

@reese reese merged commit 3e39251 into trunk Nov 27, 2022
@reese reese deleted the reese-ctrlc branch November 27, 2022 02:55
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.

Lack of signal handling
2 participants