chaos/lustre-tools-llnl — pull request #6 by nedbass (2011-12-03 01:21:31+00:00)
Title: Leave terminal in sane state

If less is not given an opportunity to exit gracefully it can leave the
terminal settings in a bad state, for example with character echo
disabled. The two common cases where this happens are with IOError and
KeyboardInterrupt exceptions. In the former case just killing the pager
process in the exception handler seems to be sufficient. On the other
hand, the only way I found to handle keyboard interrupt correctly in all
cases was to forward the SIGINT to less and exit. This requires using
-K to make less exit on SIGINT. This means you can't interrupt line
number calculating with Control-C and still remain within less, but this
seemed like a reasonable compromise.