exit.js 469 B

123456789101112131415
  1. // workaround for tty output truncation upon process.exit()
  2. var exit = process.exit;
  3. process.exit = function() {
  4. var args = [].slice.call(arguments);
  5. process.once("uncaughtException", function() {
  6. (function callback() {
  7. if (process.stdout.bufferSize || process.stderr.bufferSize) {
  8. setImmediate(callback);
  9. } else {
  10. exit.apply(process, args);
  11. }
  12. })();
  13. });
  14. throw exit;
  15. };