From: Michael Witten <mfwitten@MIT.EDU>
To: gitster@pobox.com
Cc: git@vger.kernel.org, Michael Witten <mfwitten@mit.edu>
Subject: [PATCH 2/2][Perlers?] git-send-email: SIG{TERM,INT} handlers
Date: Fri, 1 Feb 2008 23:06:01 -0500 [thread overview]
Message-ID: <1201925161-9864-2-git-send-email-mfwitten@mit.edu> (raw)
In-Reply-To: <1201925161-9864-1-git-send-email-mfwitten@mit.edu>
A single signal handler is used for both SIGTERM
and SIGINT in order to clean up after an uncouth
termination of git-send-email.
In particular, the handler resets the text color
(this cleanup was already present), turns on tty
echoing (in case termination occurrs during a
masked Password prompt), and informs the user of
of any temporary files created by --compose.
Signed-off-by: Michael Witten <mfwitten@mit.edu>
---
Perlers, please comment.
git-send-email.perl | 25 +++++++++++++++++++++++--
1 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/git-send-email.perl b/git-send-email.perl
index ed0a473..a0c9e8f 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -24,8 +24,6 @@ use Data::Dumper;
use Term::ANSIColor;
use Git;
-$SIG{INT} = sub { print color("reset"), "\n"; exit };
-
package FakeTerm;
sub new {
my ($class, $reason) = @_;
@@ -201,6 +199,29 @@ my %config_settings = (
"aliasesfile" => \@alias_files,
);
+# Handle Uncouth Termination
+sub signal_handler{
+
+ # Make text normal
+ print color("reset"), "\n";
+
+ # SMTP password masked
+ system "stty echo";
+
+ # tmp files from --compose
+ if (-e $compose_filename) {
+ print "'$compose_filename' contains an intermediate version of the email you were composing.\n";
+ }
+ if (-e ($compose_filename . ".final")) {
+ print "'$compose_filename.final' contains the composed email.\n"
+ }
+
+ exit;
+};
+
+$SIG{TERM} = \&signal_handler;
+$SIG{INT} = \&signal_handler;
+
# Begin by accumulating all the variables (defined above), that we will end up
# needing, first, from the command line:
--
1.5.4.rc5.17.g8ca921-dirty
next prev parent reply other threads:[~2008-02-02 4:06 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-01 4:59 [PATCH] git-send-email: ssh/login style password requests Michael Witten
2008-02-01 10:09 ` Junio C Hamano
2008-02-01 18:38 ` Michael Witten
2008-02-01 22:42 ` Michael Witten
2008-02-01 23:34 ` Junio C Hamano
2008-02-01 23:42 ` Michael Witten
2008-02-02 1:27 ` Junio C Hamano
2008-02-02 4:06 ` [PATCH 1/2][Perlers?] " Michael Witten
2008-02-02 4:06 ` Michael Witten [this message]
2008-02-02 21:31 ` [PATCH 2/2][Perlers?] git-send-email: SIG{TERM,INT} handlers Junio C Hamano
2008-02-02 21:31 ` [PATCH 1/2][Perlers?] git-send-email: ssh/login style password requests Junio C Hamano
2008-02-03 17:59 ` Michael Witten
2008-02-03 20:59 ` Michael Witten
2008-02-04 0:53 ` [PATCH 1/3][V.2] " Michael Witten
2008-02-04 0:53 ` [PATCH 2/3][V.2] git-send-email: SIG{TERM,INT} handlers Michael Witten
2008-02-04 0:53 ` [PATCH 3/3][V.2] git-send-email: Better handling of EOF [^D] Michael Witten
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1201925161-9864-2-git-send-email-mfwitten@mit.edu \
--to=mfwitten@mit.edu \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.