diff --git a/prim-ctl.c b/prim-ctl.c index 19cb1dd6..d8d4e31c 100644 --- a/prim-ctl.c +++ b/prim-ctl.c @@ -83,6 +83,8 @@ PRIM(catch) { EndExceptionHandler EndExceptionHandler + + SIGCHK(); } while (retry); RefEnd(lp); RefReturn(result); diff --git a/test/tests/trip.es b/test/tests/trip.es index 69dc4736..26c4401e 100644 --- a/test/tests/trip.es +++ b/test/tests/trip.es @@ -159,6 +159,35 @@ never succeeded } } +test 'signals in exception catchers' { + local (signals = sigint) { + let ( + was-blocked = false + thrown = () + thrown2 = () + ) { + catch @ { + thrown = $* + } { + catch @ e { + kill -INT $pid + was-blocked = true + } { + throw exception + } + } + catch @ { + thrown2 = $* + } { + catch @ e {kill -INT $pid} {throw exception2} + } + assert $was-blocked signal is blocked during catcher + assert {~ $thrown(1) signal} signal exception during catcher is thrown + assert {~ $thrown2(1) signal} second signal is caught + } + } +} + test 'heredocs and herestrings' { let (bigfile = `{mktemp big-file.XXXXXX}) unwind-protect {