toolong
toolong copied to clipboard
issue59: making exit more robust
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 usingsys.exit(0)
-
Added a
try-except-finally
block to handleKeyboardInterrupt
and ensure the process is properly terminated by callingprocess.terminate()
andprocess.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...