Ok, i think i found in the kernel where this is set up.
```
(define 1/check-for-break
...
(let ((exn:break*_0
(let ((tmp_0 (thread-pending-break t_0)))
(if (eq? tmp_0 'hang-up)
exn:break:hang-up/non-engine
(if (eq? tmp_0 'terminate)
exn:break:terminate/non-engine
exn:break/non-engine)))))
(begin
(set-thread-pending-break! t_0 #f)
(lambda ()
(call-with-escape-continuation
(lambda (k_0)
(raise
(|#%app|
exn:break*_0
"user break"
(current-continuation-marks)
k_0)))))))
```
Can i just hack this to check `tmp_0` for the value `'interrupt` or is that
wishful thinking? I have no idea what i'm doing =). I am just impatient and
want a SIGINT.
There must be some reason SIGINT is not explicitly supported, or i must be
missing something.
Nate
> On May 21, 2021, at 2:32 PM, Nathaniel W Griswold <[email protected]>
> wrote:
>
> I wanted to understand a limitation of the repl of the rash package (github
> issue https://github.com/willghatch/racket-rash/issues/78) as well as in the
> racket repl, i guess, and see if i could do a quick hack to get something
> working.
>
> Anyway, i just wanted to catch SIGINT without using something like the
> `unix-signals` package from Tony Garnock-Jones. I just did this:
>
> ```
> (module blah racket
> (let loop ()
> (define (read k)
> (with-handlers ([exn:break? (λ (e) (display "=BREAK=") (k #f))])
> (k (read-line))))
>
> (display "> ")
> (let ([result (call/cc read)])
> (when result
> (display result))
> (newline)
> (loop))))
> ```
>
> 1) It catches all breaks and my program won't quit =). Is there a way to
> discern if the break is a SIGINT so i can continue only on that signal and
> abort otherwise? I guess, should i just check that it's not a
> exn:break:terminate or exn:break:hang-up, or... ?
>
> 2) Are there any glaring mistakes in what i wrote other than the problems of
> (1)?
>
> Any good way to do this?
>
> Nate
>
> --
> 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/20A87695-C978-435A-9D6B-182B7D565D96%40manicmind.earth.
--
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/8435D475-421B-47D8-A5FD-CFF5A98A6FE1%40manicmind.earth.