Skip to content

Commit 52b3b48

Browse files
authored
Merge pull request #222 from jpco/signalcatchers
Small changes for signal delivery in exception catchers.
2 parents a2ac674 + 220fc28 commit 52b3b48

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

prim-ctl.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ PRIM(catch) {
8383
EndExceptionHandler
8484

8585
EndExceptionHandler
86+
87+
SIGCHK();
8688
} while (retry);
8789
RefEnd(lp);
8890
RefReturn(result);

test/tests/trip.es

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,35 @@ never succeeded
159159
}
160160
}
161161
162+
test 'signals in exception catchers' {
163+
local (signals = sigint) {
164+
let (
165+
was-blocked = false
166+
thrown = ()
167+
thrown2 = ()
168+
) {
169+
catch @ {
170+
thrown = $*
171+
} {
172+
catch @ e {
173+
kill -INT $pid
174+
was-blocked = true
175+
} {
176+
throw exception
177+
}
178+
}
179+
catch @ {
180+
thrown2 = $*
181+
} {
182+
catch @ e {kill -INT $pid} {throw exception2}
183+
}
184+
assert $was-blocked signal is blocked during catcher
185+
assert {~ $thrown(1) signal} signal exception during catcher is thrown
186+
assert {~ $thrown2(1) signal} second signal is caught
187+
}
188+
}
189+
}
190+
162191
test 'heredocs and herestrings' {
163192
let (bigfile = `{mktemp big-file.XXXXXX})
164193
unwind-protect {

0 commit comments

Comments
 (0)