Re: Is it possible to catch Ctrl-C keystroke?



Bezoar wrote:
 You can also use Expect extension  to
catch input from user ( interact )  using  \003 as the regexp .

You only get Ctrl-C as \003 if you put the terminal in raw mode. If
you don't, it is converted to a signal before it gets to Tcl. (OK,
strictly you could also reconfigure the terminal to make another
character be the INTR sequence. But that's just moving the problem
around. But that's really just scraping the surface of Unix terminals,
and is probably more than you want to know.) Since the original
question related to cleaning up on exit, signals are absolutely the
right way to do it.

Donal.
.



Relevant Pages

  • Re: Is it possible to catch Ctrl-C keystroke?
    ... But that's really just scraping the surface of Unix terminals, ... question related to cleaning up on exit, signals are absolutely the ... error writing "stdout": broken pipe ... while executing ...
    (comp.lang.tcl)
  • Re: Is it possible to catch Ctrl-C keystroke?
    ... But that's really just scraping the surface of Unix terminals, ... question related to cleaning up on exit, signals are absolutely the ... while executing ... It successfully trapped Ctrl-C and finished executing "exec touch ...
    (comp.lang.tcl)
  • Re: subprocess leaves child living
    ... Isn't it possible to open processes in such a way like terminals? ... On POSIX platform you can use signals and ``os.kill`` function. ... raise KeyboardInterrupt ...
    (comp.lang.python)
  • Re: Is it possible to catch Ctrl-C keystroke?
    ... But that's really just scraping the surface of Unix terminals, ... question related to cleaning up on exit, signals are absolutely the ...     while executing ... error writing "stdout": broken pipe ...
    (comp.lang.tcl)
  • Re: subprocess leaves child living
    ... open processes in such a way like terminals? ... If I kill the terminal, ... everything open in it will die too. ... On POSIX platform you can use signals and ``os.kill`` function. ...
    (comp.lang.python)