orocos-toolchain / ocl

Orocos Component Library
Other
16 stars 33 forks source link

taskbrowser: install signal handler for SIGINT and disabled signal handling in readline #7

Closed meyerj closed 10 years ago

meyerj commented 10 years ago

This patch installs a signal handler for SIGINT in the TaskBrowser so that it shutdowns cleanly on Ctrl+C or if the process is interrupted by its parent process (e.g. when running in roslaunch). Until now an interactive deployer just terminates the application without proper cleanup in this case.

To make this work it was necessary to disable the signal handlers in libreadline by setting the global variable rl_catch_signals to 0. I am not sure which other drawbacks this might have. The TaskBrowser itself only handles SIGINT and SIGWINCH.

Aborting the current command line with Ctrl-C is still broken for some reason. It also fails if I just ignore the SIGINT signal in the TaskBrowser in order to not terminate the application immediately without further patches and with the rl_catch_signals set to 1, while the readline documentation says that its signal handler should abort the current input line on SIGINT (by calling void rl_free_line_state (void)). Might be a bug in readline?

The current behavior is that SIGINT only terminates the application if the input line is empty and prints ^C otherwise.