A PureScript port of the human-signals (NPM Library) JavaScript Library with type-safety enhancements.
Human-friendly process signals.
This is a map of known process signals with some information about each signal.
Unlike
os.constants.signals
this includes:
- human-friendly descriptions
- default actions, including whether they can be prevented
- whether the signal is supported by the current OS
Unlike the JavaScript library (i.e. fulfilling the library's license requirements by stating what was changed), this port:
- is written in PureScript
- provides three ways to look up a signal whereas the JS library only provides two:
byNumber- same as the JS library: lookup a signal by its numberbyString- same as the JS library: lookup a signal via a dynamic stringbyName- different from the JS library: lookup a signal via a static string, guaranteeing the value actually exists
- fully enumerates the possible values of the
SIGRT1-SIGRT31so that they can be referenced via thebyNamefield.
module Foo where
import Node.Library.HumanSignals (signals)
main :: Effect Unit
main = do
log $ show signals.byName."SIGINT"
-- {
-- , name: "SIGINT"
-- , number: 2
-- , description: "User interruption with CTRL-C"
-- , supported: true
-- , action: Terminate
-- , forced: false
-- , standard: Ansi
-- }
log $ show $ Map.lookup 8 signals.byNumber
-- {
-- , name: "SIGFPE"
-- , number: 8
-- , description: "Floating point arithmetic error"
-- , supported: true
-- , action: Core
-- , forced: false,
-- , standard: Ansi
-- }spago install node-human-signalsStandard name of the signal, for example 'SIGINT'.
Code number of the signal, for example 2. While most number are
cross-platform, some are different between different OS.
Human-friendly description for the signal, for example
'User interruption with CTRL-C'.
Whether the current OS can handle this signal in Node.js using
process.on(name, handler).
The list of supported signals is OS-specific.
What is the default action for this signal when it is not handled.
Whether the signal's default action cannot be prevented. This is true for
SIGTERM, SIGKILL and SIGSTOP.
Which standard defined that signal.