Skip to content

issue59: making exit more robust - #60

Open
Roobxyz wants to merge 1 commit into
Textualize:mainfrom
Roobxyz:issue59
Open

issue59: making exit more robust#60
Roobxyz wants to merge 1 commit into
Textualize:mainfrom
Roobxyz:issue59

Conversation

@Roobxyz

@Roobxyz Roobxyz commented Sep 30, 2024

Copy link
Copy Markdown

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

1 participant