Gentoo Archives: gentoo-user

From: "»Q«" <boxcars@×××.net>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Re: Shell echo missing after ctrl+c
Date: Mon, 20 Mar 2017 19:49:30
Message-Id: 20170320144851.359d7cb0@sepulchrave.remarqs
In Reply to: [gentoo-user] Re: Shell echo missing after ctrl+c by Ian Zimmerman
1 On Sun, 19 Mar 2017 22:00:31 -0700
2 Ian Zimmerman <itz@×××××××.net> wrote:
3
4 > On 2017-03-19 22:09, Walter Dnes wrote:
5 >
6 > > If killed with CTRL-C or "kill -9" or "kill -15", it doesn't have a
7 > > chance to restore echoing, and you get the situation you
8 > > described.
9 >
10 > Correct about kill -9, but properly programmed full screen programs
11 > _do_ install signal handlers for SIGTERM (kill -15) and SIGINT (^C)
12 > to avoid this situation. The ncurses library even does that for
13 > programs that link with, IIRC (it has been a while since I've done
14 > any of that stuff).
15 >
16 > One reason why you should consider gentler means before taking a
17 > SIGKILL (kill -9) to a misbehaving program.
18
19 I run into this issue most often when I use ctrl+c to stop a bash
20 script. ISTM a 'trap' in the script could be used to restore echo
21 before exit, but my bash-fu isn't strong enough to figure it out.