git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH/RFC] test-lib: clean up trash* directories on SIGINT
@ 2010-07-11  9:51 Ævar Arnfjörð Bjarmason
  2010-07-11 11:55 ` Andreas Schwab
  2010-07-12  3:32 ` Nicolas Pitre
  0 siblings, 2 replies; 7+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-07-11  9:51 UTC (permalink / raw)
  To: Git Mailing List

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 ...
 #

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-07-12  8:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-11  9:51 [PATCH/RFC] test-lib: clean up trash* directories on SIGINT Ævar Arnfjörð Bjarmason
2010-07-11 11:55 ` 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

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).