When stoping the script with ctrl+alt+m python wont catch it as an interruption. I want to execute a cleanup script before exiting.
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
print("keyboardInterrupt")
finally:
handle_cleanup()
How does code runner stop codes and what are my options to achive my goal?