Re: [PATCH] Reset terminal attributes when terminating git send-email

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH] Reset terminal attributes when terminating git send-email

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:29

Sean Estabrooks [off-list ref] writes:
quoted hunk
If you break out of the prompts presented to you by git send-email
your terminal can be left in an inconsistent state.  Here we trap
the interrupt signal and reset the terminal before exiting.

Signed-off-by: Sean Estabrooks <redacted>
---
 git-send-email.perl |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/git-send-email.perl b/git-send-email.perl
index 69559b2..f1a8855 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -21,8 +21,11 @@ use warnings;
 use Term::ReadLine;
 use Getopt::Long;
 use Data::Dumper;
+use Term::ANSIColor;
 use Git;
 
+$SIG{INT} = sub { print color("reset"), "\n"; exit };
+
 package FakeTerm;
 sub new {
 	my ($class, $reason) = @_;
I wonder if this is something Term::ReadLine when not using
FakeTerm should and does provide...  Is this the standard
workaround all the applications that use Term::ReadLine need to
implement themselves?

Re: [PATCH] Reset terminal attributes when terminating git send-email

From: Sean <hidden>
Date: 2016-06-15 22:43:29

On Fri, 17 Aug 2007 15:19:15 -0700
Junio C Hamano [off-list ref] wrote:
I wonder if this is something Term::ReadLine when not using
FakeTerm should and does provide...  Is this the standard
workaround all the applications that use Term::ReadLine need to
implement themselves?
Unfortunately Term::ReadLine (at least here with perl 5.8.8) does
not properly reset the terminal even when used in a test script
without FakeTerm.   I don't know anything about perl and couldn't
turn up any answers to this problem with Google, but maybe there
is still a better solution known.  It would sure be much nicer if
ReadLine just took care of this detail itself.

Sean
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help