UNPKG

on-exit

Version:

Register tasks to perform when the process exits.

16 lines (12 loc) 262 B
var onExit = require('../'); function send(val) { return function() { process.send(val); }; } onExit(send(1)); onExit(send(2)); onExit(send(3)); setTimeout(function() { throw new Error('This process should be killed before the timeout fires'); }, 1500);