-
Notifications
You must be signed in to change notification settings - Fork 73
Open
Description
less.js-middleware/lib/middleware.js
Line 71 in a9e0947
process.kill(process.pid, 'SIGINT'); // Let other SIGINT handlers run, if there are any |
The code line above interferes with another optional handlers for "SIGINT"
by calling them a second time on the first time the signal appears.
This can lead into bugs if a node application depends on less-middleware
and registers handlers for "SIGINT" them self.
The following simulation shows,
that the code line is not needed for other handlers to receive the signal too:
Code used in the simulation:
// For closing the app after 5 seconds
setTimeout(() => process.exit(), 5000);
// Simulating handler added before include of less-middleware
let defaultCounter = 0;
process.on("SIGINT", () => {
defaultCounter++;
console.log("Default handler called " + defaultCounter + " times");
});
// Simulating handler of less-middleware
process.once("SIGINT", () => {
console.log("Once handler");
// process.kill(process.pid, "SIGINT"); // The code interfering
});
// Simulating handler added after include of less-middleware
let secondCounter = 0;
process.on("SIGINT", () => {
secondCounter++;
console.log("Second default handler called " + secondCounter + " times");
});
Metadata
Metadata
Assignees
Labels
No labels