git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 17, 2007, 22:19 UTC
Message-ID
<7vr6m1g5y4.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<11873867051589-git-send-email-seanlkml@sympatico.ca>
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?

Previous: Sean EstabrooksNext: Sean
Message 3 of 4 in “Fix small typo in git send-email man page.”
  1. Fix small typo in git send-email man page.Sean Estabrooks, Aug 17, 2007
  2. Reset terminal attributes when terminating git send-emailSean Estabrooks, Aug 17, 2007
  3. Junio C HamanoAug 17, 2007
  4. SeanAug 17, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.