| 1 | [](https://codecov.io/gh/ehmicky/human-signals)
|
|---|
| 2 | [](https://travis-ci.org/ehmicky/human-signals)
|
|---|
| 3 | [](https://www.npmjs.com/package/human-signals)
|
|---|
| 4 | [](https://gitter.im/ehmicky/human-signals)
|
|---|
| 5 | [](https://twitter.com/intent/follow?screen_name=ehmicky)
|
|---|
| 6 | [](https://medium.com/@ehmicky)
|
|---|
| 7 |
|
|---|
| 8 | Human-friendly process signals.
|
|---|
| 9 |
|
|---|
| 10 | This is a map of known process signals with some information about each signal.
|
|---|
| 11 |
|
|---|
| 12 | Unlike
|
|---|
| 13 | [`os.constants.signals`](https://nodejs.org/api/os.html#os_signal_constants)
|
|---|
| 14 | this includes:
|
|---|
| 15 |
|
|---|
| 16 | - human-friendly [descriptions](#description)
|
|---|
| 17 | - [default actions](#action), including whether they [can be prevented](#forced)
|
|---|
| 18 | - whether the signal is [supported](#supported) by the current OS
|
|---|
| 19 |
|
|---|
| 20 | # Example
|
|---|
| 21 |
|
|---|
| 22 | ```js
|
|---|
| 23 | const { signalsByName, signalsByNumber } = require('human-signals')
|
|---|
| 24 |
|
|---|
| 25 | console.log(signalsByName.SIGINT)
|
|---|
| 26 | // {
|
|---|
| 27 | // name: 'SIGINT',
|
|---|
| 28 | // number: 2,
|
|---|
| 29 | // description: 'User interruption with CTRL-C',
|
|---|
| 30 | // supported: true,
|
|---|
| 31 | // action: 'terminate',
|
|---|
| 32 | // forced: false,
|
|---|
| 33 | // standard: 'ansi'
|
|---|
| 34 | // }
|
|---|
| 35 |
|
|---|
| 36 | console.log(signalsByNumber[8])
|
|---|
| 37 | // {
|
|---|
| 38 | // name: 'SIGFPE',
|
|---|
| 39 | // number: 8,
|
|---|
| 40 | // description: 'Floating point arithmetic error',
|
|---|
| 41 | // supported: true,
|
|---|
| 42 | // action: 'core',
|
|---|
| 43 | // forced: false,
|
|---|
| 44 | // standard: 'ansi'
|
|---|
| 45 | // }
|
|---|
| 46 | ```
|
|---|
| 47 |
|
|---|
| 48 | # Install
|
|---|
| 49 |
|
|---|
| 50 | ```bash
|
|---|
| 51 | npm install human-signals
|
|---|
| 52 | ```
|
|---|
| 53 |
|
|---|
| 54 | # Usage
|
|---|
| 55 |
|
|---|
| 56 | ## signalsByName
|
|---|
| 57 |
|
|---|
| 58 | _Type_: `object`
|
|---|
| 59 |
|
|---|
| 60 | Object whose keys are signal [names](#name) and values are
|
|---|
| 61 | [signal objects](#signal).
|
|---|
| 62 |
|
|---|
| 63 | ## signalsByNumber
|
|---|
| 64 |
|
|---|
| 65 | _Type_: `object`
|
|---|
| 66 |
|
|---|
| 67 | Object whose keys are signal [numbers](#number) and values are
|
|---|
| 68 | [signal objects](#signal).
|
|---|
| 69 |
|
|---|
| 70 | ## signal
|
|---|
| 71 |
|
|---|
| 72 | _Type_: `object`
|
|---|
| 73 |
|
|---|
| 74 | Signal object with the following properties.
|
|---|
| 75 |
|
|---|
| 76 | ### name
|
|---|
| 77 |
|
|---|
| 78 | _Type_: `string`
|
|---|
| 79 |
|
|---|
| 80 | Standard name of the signal, for example `'SIGINT'`.
|
|---|
| 81 |
|
|---|
| 82 | ### number
|
|---|
| 83 |
|
|---|
| 84 | _Type_: `number`
|
|---|
| 85 |
|
|---|
| 86 | Code number of the signal, for example `2`. While most `number` are
|
|---|
| 87 | cross-platform, some are different between different OS.
|
|---|
| 88 |
|
|---|
| 89 | ### description
|
|---|
| 90 |
|
|---|
| 91 | _Type_: `string`
|
|---|
| 92 |
|
|---|
| 93 | Human-friendly description for the signal, for example
|
|---|
| 94 | `'User interruption with CTRL-C'`.
|
|---|
| 95 |
|
|---|
| 96 | ### supported
|
|---|
| 97 |
|
|---|
| 98 | _Type_: `boolean`
|
|---|
| 99 |
|
|---|
| 100 | Whether the current OS can handle this signal in Node.js using
|
|---|
| 101 | [`process.on(name, handler)`](https://nodejs.org/api/process.html#process_signal_events).
|
|---|
| 102 |
|
|---|
| 103 | The list of supported signals
|
|---|
| 104 | [is OS-specific](https://github.com/ehmicky/cross-platform-node-guide/blob/master/docs/6_networking_ipc/signals.md#cross-platform-signals).
|
|---|
| 105 |
|
|---|
| 106 | ### action
|
|---|
| 107 |
|
|---|
| 108 | _Type_: `string`\
|
|---|
| 109 | _Enum_: `'terminate'`, `'core'`, `'ignore'`, `'pause'`, `'unpause'`
|
|---|
| 110 |
|
|---|
| 111 | What is the default action for this signal when it is not handled.
|
|---|
| 112 |
|
|---|
| 113 | ### forced
|
|---|
| 114 |
|
|---|
| 115 | _Type_: `boolean`
|
|---|
| 116 |
|
|---|
| 117 | Whether the signal's default action cannot be prevented. This is `true` for
|
|---|
| 118 | `SIGTERM`, `SIGKILL` and `SIGSTOP`.
|
|---|
| 119 |
|
|---|
| 120 | ### standard
|
|---|
| 121 |
|
|---|
| 122 | _Type_: `string`\
|
|---|
| 123 | _Enum_: `'ansi'`, `'posix'`, `'bsd'`, `'systemv'`, `'other'`
|
|---|
| 124 |
|
|---|
| 125 | Which standard defined that signal.
|
|---|
| 126 |
|
|---|
| 127 | # Support
|
|---|
| 128 |
|
|---|
| 129 | If you found a bug or would like a new feature, _don't hesitate_ to
|
|---|
| 130 | [submit an issue on GitHub](../../issues).
|
|---|
| 131 |
|
|---|
| 132 | For other questions, feel free to
|
|---|
| 133 | [chat with us on Gitter](https://gitter.im/ehmicky/human-signals).
|
|---|
| 134 |
|
|---|
| 135 | Everyone is welcome regardless of personal background. We enforce a
|
|---|
| 136 | [Code of conduct](CODE_OF_CONDUCT.md) in order to promote a positive and
|
|---|
| 137 | inclusive environment.
|
|---|
| 138 |
|
|---|
| 139 | # Contributing
|
|---|
| 140 |
|
|---|
| 141 | This project was made with ❤️. The simplest way to give back is by starring and
|
|---|
| 142 | sharing it online.
|
|---|
| 143 |
|
|---|
| 144 | If the documentation is unclear or has a typo, please click on the page's `Edit`
|
|---|
| 145 | button (pencil icon) and suggest a correction.
|
|---|
| 146 |
|
|---|
| 147 | If you would like to help us fix a bug or add a new feature, please check our
|
|---|
| 148 | [guidelines](CONTRIBUTING.md). Pull requests are welcome!
|
|---|
| 149 |
|
|---|
| 150 | Thanks go to our wonderful contributors:
|
|---|
| 151 |
|
|---|
| 152 | <!-- ALL-CONTRIBUTORS-LIST:START -->
|
|---|
| 153 | <!-- prettier-ignore-start -->
|
|---|
| 154 | <!-- markdownlint-disable -->
|
|---|
| 155 | <table>
|
|---|
| 156 | <tr>
|
|---|
| 157 | <td align="center"><a href="https://twitter.com/ehmicky"><img src="https://avatars2.githubusercontent.com/u/8136211?v=4" width="100px;" alt=""/><br /><sub><b>ehmicky</b></sub></a><br /><a href="https://github.com/ehmicky/human-signals/commits?author=ehmicky" title="Code">💻</a> <a href="#design-ehmicky" title="Design">🎨</a> <a href="#ideas-ehmicky" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/ehmicky/human-signals/commits?author=ehmicky" title="Documentation">📖</a></td>
|
|---|
| 158 | <td align="center"><a href="http://www.electrovir.com"><img src="https://avatars0.githubusercontent.com/u/1205860?v=4" width="100px;" alt=""/><br /><sub><b>electrovir</b></sub></a><br /><a href="https://github.com/ehmicky/human-signals/commits?author=electrovir" title="Code">💻</a></td>
|
|---|
| 159 | </tr>
|
|---|
| 160 | </table>
|
|---|
| 161 |
|
|---|
| 162 | <!-- markdownlint-enable -->
|
|---|
| 163 | <!-- prettier-ignore-end -->
|
|---|
| 164 |
|
|---|
| 165 | <!-- ALL-CONTRIBUTORS-LIST:END -->
|
|---|