1
0
mirror of https://github.com/janet-lang/janet synced 2024-06-18 11:19:56 +00:00
janet/examples/sigaction.janet
Calvin Rose f45571033c Add os/sigaction for signal handling.
Also improve interrupts to work better with busy loops
and signals.
2023-08-19 13:26:29 -05:00

11 lines
276 B
Plaintext

(defn action []
(print "Handled SIGHUP!")
(flush))
(defn main [_]
# Set the interrupt-interpreter argument to `true` to allow
# interrupting the busy loop `(forever)`. By default, will not
# interrupt the interpreter.
(os/sigaction :hup action true)
(forever))