[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Quilt-dev] [PATCH 2/2] test: Clean up when interrupted
From: |
Jean Delvare |
Subject: |
[Quilt-dev] [PATCH 2/2] test: Clean up when interrupted |
Date: |
Sat, 27 Jan 2018 18:13:06 +0100 |
If the user hits Ctrl+C while a test is running, don't leave our
working directory behind.
Signed-off-by: Jean Delvare <address@hidden>
---
test/run | 2 ++
1 file changed, 2 insertions(+)
--- quilt.orig/test/run 2018-01-27 09:52:17.787665402 +0100
+++ quilt/test/run 2018-01-27 15:51:32.304789347 +0100
@@ -255,6 +255,8 @@ sub process_test($$$$) {
# Create a dedicated working directory
mkdir $workdir or die "Failed to create directory $workdir: $!";
+# Clean up on Ctrl+C
+$SIG{INT} = sub { if (chdir $origdir) { system "rm -rf $workdir" }; exit 1; };
chdir $workdir or die "Failed to change to directory $workdir: $!";
$ENV{PWD} = getcwd;
--
Jean Delvare
SUSE L3 Support