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
see http://man7.org/linux/man-pages/man7/signal-safety.7.html

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 https://gist.github.com/aspyct/3462238 is calling printf in the handler but should not)

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

<https://xojo.com/issue/2332>

Oh, I would have never found that. Thanks!

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

http://www.monkeybreadsoftware.net/class-signalhandlermbs.shtml

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