threads / patch / 9566

patchReset terminal attributes when terminating git send-email

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

## tl;dr

4 messages between Aug 17, 2007 and Aug 17, 2007. Diffs are folded; open one to read it.

replies: 3people: 2as markdown or json

Sean Estabrooks· Aug 17, 2007, 21:38 UTC · lore

[PATCH] Fix small typo in git send-email man page.

Signed-off-by: Sean Estabrooks <seanlkml@sympatico.ca>
---
 Documentation/git-send-email.txt |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Show changes to Documentation/git-send-email.txt +1 −1
diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index d243ed1..08a023e 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -62,7 +62,7 @@ The --cc option must be repeated for each user you want on the cc list.
 --signed-off-by-cc, --no-signed-off-by-cc::
         If this is set, add emails found in Signed-off-by: or Cc: lines to the
         cc list.
-        Default is the value of 'sendemail.signedoffbycc' configuration value;
+        Default is the value of 'sendemail.signedoffcc' configuration value;
         if that is unspecified, default to --signed-off-by-cc.
 
 --quiet::
-- 
1.5.3.rc5.18.gcb57
Sean Estabrooks· Aug 17, 2007, 21:38 UTC · re: Sean Estabrooks · lore

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 <seanlkml@sympatico.ca>
---
 git-send-email.perl |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
Show changes to git-send-email.perl +3 −0
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) = @_;
-- 
1.5.3.rc5.18.gcb57
Junio C Hamano· Aug 17, 2007, 22:19 UTC · re: Sean Estabrooks · lore

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

Sean Estabrooks <seanlkml@sympatico.ca> writes:
Show 25 quoted lines
> 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 <seanlkml@sympatico.ca>
> ---
>  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?

Sean· Aug 17, 2007, 22:35 UTC · re: Junio C Hamano · lore

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

On Fri, 17 Aug 2007 15:19:15 -0700 Junio C Hamano <gitster@pobox.com> 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

← back to recent threads