Skip to content

Instantly share code, notes, and snippets.

@isaacs
Created January 27, 2012 01:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isaacs/1686286 to your computer and use it in GitHub Desktop.
Save isaacs/1686286 to your computer and use it in GitHub Desktop.
// node fail.js | head -n3
function write()
{
try {
process.stdout.write('Hello, world\n');
} catch (ex) {
throw new Error('this should not happen');
}
process.nextTick(function () { write(); });
}
process.stdout.on('error', function (er) {
console.error(er);
process.exit(42);
});
write();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment