Skip to content

Commit 8af543f

Browse files
committed
Teach Test() to abort test if ctrl-C is pressed
This is a bit of a hack, but seems to work very well in practice. You can even resume the test with `return` if you want (but the interrupted line will still lead to diffs). Resolves #1879
1 parent 44f1a0c commit 8af543f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/test.gi

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,12 @@ InstallGlobalFunction(RunTests, function(arg)
136136
t := Runtime() - t;
137137
CloseStream(fres);
138138
CloseStream(s);
139+
# check whether the user aborted by pressing ctrl-C
140+
if StartsWith(res, "Error, user interrupt") then
141+
BreakOnError := breakOnError;
142+
Error("user interrupt");
143+
BreakOnError := opts.breakOnError;
144+
fi;
139145
Add(cmp, res);
140146
Add(times, t);
141147
od;

0 commit comments

Comments
 (0)