pieces-app / cli-agent

Pieces CLI for interacting with Pieces OS
https://docs.pieces.app/extensions-plugins/cli
MIT License
46 stars 16 forks source link

Improve Handling of KeyboardInterrupt Exceptions #136

Closed mdex-geek closed 2 months ago

mdex-geek commented 2 months ago

Currently, when the script is interrupted using Ctrl+C, it raises a KeyboardInterrupt exception, which may cause the script to freeze or terminate unexpectedly, leaving the user without guidance on how to properly exit. This can be especially problematic if the script is running in a terminal, as the only option might be to kill the terminal session entirely.

To improve the user experience, I propose adding a handler for the KeyboardInterrupt exception that provides a clear message on how to exit the script properly.

Steps to Reproduce Run the script. Press Ctrl+C to interrupt the script. Observe the raised KeyboardInterrupt exception and the script's behavior. Expected Behavior When Ctrl+C is pressed, the script should catch the KeyboardInterrupt exception and display a message instructing the user on how to exit the script properly. Screenshot 2024-06-20 180254