From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Git Mailing List <git@vger.kernel.org>
Subject: [PATCH/RFC] test-lib: clean up trash* directories on SIGINT
Date: Sun, 11 Jul 2010 09:51:02 +0000 [thread overview]
Message-ID: <AANLkTimnrLlprdScYDKHs_lIvFKc3K0n8U5vTzG_df2k@mail.gmail.com> (raw)
Is there any reason not to remove trash directories on SIGINT? It's
annoying that trash directories are left when I cancel a test run.
I can submit an actual patch along these lines once Junio applies some
of my other stuff which will probably conflict with any finalized
patch.
Is "trap 'foo' INT" a bashism? Is "trap 'foo' SIGINT" more portable?
How about the exit code from an INT handler, what should it be?
diff --git a/t/test-lib.sh b/t/test-lib.sh
index ac496aa..e4a0fc9 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -222,6 +222,17 @@ die () {
GIT_EXIT_OK=
trap 'die' EXIT
+git_interrupted () {
+ test -d "$remove_trash" &&
+ cd "$(dirname "$remove_trash")" &&
+ rm -rf "$(basename "$remove_trash")"
+
+ # What my shell normal exits on on sigint
+ exit 130
+}
+
+trap 'git_interrupted' INT
+
# The semantics of the editor variables are that of invoking
# sh -c "$EDITOR \"$@\"" files ...
#
next reply other threads:[~2010-07-11 9:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-11 9:51 Ævar Arnfjörð Bjarmason [this message]
2010-07-11 11:55 ` [PATCH/RFC] test-lib: clean up trash* directories on SIGINT Andreas Schwab
2010-07-12 3:32 ` Nicolas Pitre
2010-07-12 5:42 ` Ævar Arnfjörð Bjarmason
2010-07-12 6:16 ` Jonathan Nieder
2010-07-12 8:16 ` Ævar Arnfjörð Bjarmason
2010-07-12 8:56 ` Jonathan Nieder
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=AANLkTimnrLlprdScYDKHs_lIvFKc3K0n8U5vTzG_df2k@mail.gmail.com \
--to=avarab@gmail.com \
--cc=git@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).