Override default signal handler in interactive shell

P

pkassianidis

Hello everybody,

I have written a python script which executes some functions and then
returns to the python interactive shell prompt (In other words I use
the command
"#!/usr/bin/python -i " in the script's header.
In this script I register my own handler for the SIGINT and SIGTERM
handlers but when I press Control-C the default handler is invoked and
the message "KeyboardInterrupt" is displayed. If I don't allow the
script to return control to the interactive shell, by putting for
example an endless loop, then my handler works fine. Does anyone know,
how I can make it work in the first case also? Thank you very much.

Best Regards

Panos
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top