Override default signal handler in interactive shell

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • pkassianidis@gmail.com

    #1

    Override default signal handler in interactive shell

    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 "KeyboardInterr upt" 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

Working...