I have a little model of a server below. The server handles all exceptions, and 
restarts itself after some errors. It also handles break?, to actually exit 
when requested.

While this server is running, if I press Ctrl+C before `(error 'foo)` is 
handled, the server exits correctly with 120. However, if I press Ctrl+C after 
`(error 'foo)` is handled, the `exn:break?` handler is never called, the server 
no longer responds to `Ctrl+C`, and (in this example) it eventually exits with 
status `1`.

I cannot figure out why. As far as I can tell, this should always handle 
`Ctrl+C` by exiting with 120.

> #lang racket/base
> 
> (let loop ([n 0])
>   (with-handlers ([exn:break? (lambda _ (exit 120))]
>                   [void
>                    (lambda (exn)
>                      (printf "handled error: ~a~n" (exn-message exn))
>                      (loop (add1 n)))])
>     (displayln n)
>     (sleep 1)
>     (cond
>       [(zero? n) (error 'foo)]
>       [(= n 5) (exit 1)])
>     (loop (add1 n))))

-- 
William J. Bowman

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/YV%2BSWNpldfOB5tA3%40williamjbowman.com.

Reply via email to