Trapping SIGHUP on macOS and Linux

Is there a way to trap and deal with SIGHUP on a console app? I’d like to deal with kill signals in special ways depending on the signal.

Not really. No
Even in C they are VERY strict as to what can / cannot be accessed & used from the std library of C functions (never mind C++)
You shouldn’t even call something like printf in a signal handler

Xojo code isn’t going to be able to do this

EDIT : there’s lots of sample code in C (but note even a lengthy one like this is calling printf in the handler but should not)

I’ll file a FR later, thanks for the info.


Oh, I would have never found that. Thanks!

Check the MBS plugins as there is a class that allows certain signals to be captured.

SignalHandlerMBS can have signals set a flag which you can query later.
This way we make sure we can do cleanup.