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

issue59: making exit more robust #60

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

Conversation

Roobxyz
Copy link

@Roobxyz Roobxyz commented Sep 30, 2024

Overview

Explicitly calling sys.exit when ctrl-C is pressed.
Finally block ensures termination of reading /dev/tty.
Better signal handling on interupt.

Changes

  • src/toolong/cli.py

Signal Handling Enhancements:

  • Improved the request_exit function to handle termination signals more gracefully by using sys.exit(0)

  • Added a try-except-finally block to handle KeyboardInterrupt and ensure the process is properly terminated by calling process.terminate() and process.wait().

Minor Adjustments:

  • moved import sys inside the run, this might be unnecessary but I was getting "sys" referenced before assignment if I left it at global...

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