June 2014
Intermediate to advanced
696 pages
38h 52m
English
A great feature of the process module is that it allows you to register listeners to handle signals that the operating system sends to a process. This is helpful when you need to perform certain actions such as cleanup before a process is stopped or terminated. Table 9.1 lists the process events for which you can add listeners.
Table 9.1 Events that can be sent to Node.js processes
To register for a process signal, simply use the on(event, callback) method. For example, to register an event handler for the SIGBREAK event, you would use the following code:
process.on('SIGBREAK', function(){ ...
Read now
Unlock full access