c - How to terminate an ncurses program with the `raw()` setting turned on? -
in order save time, i'd know if there's professional way terminate unresponsive ncurses program (from terminal) raw()
setting turned on. here, ctrl+c won't help.
example progam:
#include <ncurses.h> int main() { initscr(); raw(); while(1) { printw("yello\n"); } refresh(); endwin(); return 0; }
whenever hit control-c
(c-c
) combination, terminal parses , sends signal (sigint) whatever application running in foreground. control-c
has no special meaning operating system, terminal.
when call ncurses' raw()
or cbreak()
function, instructs terminal ignore these special characters , pass them on directly whatever's running in foreground, instructing terminal application "knows it's doing".
so yes, have "manually" (i.e. terminal) kill running application:
ps aux | grep your_executable_name kill the_pid
yes, can while in tty. , yes, can jam whole system if lock available ttys (and don't have ssh access).
Comments
Post a Comment