Skip to content

Commit

Permalink
now terminating the process at the next tick
Browse files Browse the repository at this point in the history
  • Loading branch information
Joachim Kainz committed Oct 4, 2011
1 parent ccdb3e6 commit bf0feb9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion examples/master.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,11 @@ backgrounder.spawn(__dirname + "/worker.js", {
break;
case 2:
break;
case 3:
console.log("Master: child idle before terminate");
break;
default:
console.error("Master: unexpected idle message ", counter, message);
console.error("Master: unexpected idle message", counter);
}
});
});
4 changes: 3 additions & 1 deletion lib/backgrounder-launcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ function processMessage(message) {
emitter.emit(parsed.type, parsed.content, callback);

if ("terminate" === parsed.type) {
process.exit(0);
process.nextTick(function () {
process.exit(0);
});
}
}
//
Expand Down

0 comments on commit bf0feb9

Please sign in to comment.