How does ^C work in Python?

Hal Murray hmurray at megapathdsl.net
Tue Sep 27 18:07:34 UTC 2016


dan-ntp at drown.org said:
> Does python have an option to just exit with the sigint   signal handler and
> not rely on the interpreter state?

That works for "ntpq -p", but there are two cases in ntpq where that isn't 
good enough.

One is when running in interactive mode.  I suppose that could be fixed by 
running each command in a separate thread.  If ^C happens, kill that thread 
and ignore it.

The other is the mrulist command.  It's two loops.  One to collect the info 
and another to print it out.  (there may be a sort in between)  ^C during the 
first loop is supposed to stop collecting, then print what has been collected.


-- 
These are my opinions.  I hate spam.





More information about the devel mailing list