data PosixSignal : Type
- Totality: total
SigHUP : PosixSignal
Hangup (i.e. controlling terminal closed)
SigQUIT : PosixSignal
SigTRAP : PosixSignal
Trap (as used by debuggers)
SigUser1 : PosixSignal
SigUser2 : PosixSignal
data Signal : Type
- Totality: total
SigINT : Signal
Interrupt (e.g. ctrl+c pressed)
SigABRT : Signal
SigILL : Signal
SigSEGV : Signal
SigFPE : Signal
SigPosix : PosixSignal -> Signal
Signals only available on POSIX operating systems
data SignalError : Type
An Error represented by a code. See
relevant `errno` documentation.
Error : Int -> SignalError
collectSignal : HasIO io => Signal -> io (Either SignalError ())
Collect the given signal.
This replaces the existing handling of the given signal
and instead results in Idris collecting occurrences of
the signal until you call `handleNextCollectedSignal`.
First, call `collectSignal` for any number of signals.
Then, call `handleNextCollectedSignal` in each main loop
of your program to retrieve (and mark as handled) the next
signal that was collected, if any.
Signals are not queued, so the return order of signals is
not specified and signals may be deduplicated.
defaultSignal : HasIO io => Signal -> io (Either SignalError ())
Use the default handler for the given signal.
You can use this function to unset custom
handling of a signal.
handleManyCollectedSignals : HasIO io => Fuel -> io (List Signal)
Get many collected signals and mark them as handled.
Use `forever` as your fuel if you don't want or need to
retain totality. Alternatively, pick a max number to
retrieve and use `limit/1` as your fuel.
handleNextCollectedSignal : HasIO io => io (Maybe Signal)
Get next collected signal under the pretense of handling it.
Calling this "marks" the signal as handled so the next time
this function is called you will retrieve the next unhandled
signal instead of the same signal again.
You get back Nothing if there are no pending signals.
ignoreSignal : HasIO io => Signal -> io (Either SignalError ())
Ignore the given signal.
Be careful doing this, as most signals have useful
default behavior -- you might want to set the signal
to its default behavior instead with `defaultSignal`.
raiseSignal : HasIO io => Signal -> io (Either SignalError ())
Send a signal to the current process.