* Add process interruption handler * * When the first handler is added then automatically * sets up process interruption signals listeners * * @private * @method addHandler * @param {function} cb Callback to be called when process interruption fired
(cb)
| 76 | * @param {function} cb Callback to be called when process interruption fired |
| 77 | */ |
| 78 | addHandler(cb) { |
| 79 | if (!_process) { |
| 80 | throw new Error('process is not captured'); |
| 81 | } |
| 82 | |
| 83 | let index = handlers.indexOf(cb); |
| 84 | if (index > -1) { |
| 85 | return; |
| 86 | } |
| 87 | |
| 88 | if (handlers.length === 0) { |
| 89 | setupSignalsTrap(); |
| 90 | } |
| 91 | |
| 92 | handlers.push(cb); |
| 93 | captureExit.onExit(cb); |
| 94 | }, |
| 95 | |
| 96 | /** |
| 97 | * Remove process interruption handler |
nothing calls this directly
no test coverage detected
searching dependent graphs…