Skip to content

Commit b938b8d

Browse files
committed
Merge pull request #127 from substack/remove
Remove uncaught-exception listener
2 parents 00835d8 + 9c60d32 commit b938b8d

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

index.js

+9-11
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,18 @@ function createExitHarness (conf) {
6363

6464
if (conf.exit === false) return harness;
6565
if (!canEmitExit || !canExit) return harness;
66-
67-
var _error;
6866

69-
process.on('uncaughtException', function (err) {
70-
if (err && err.code === 'EPIPE' && err.errno === 'EPIPE'
71-
&& err.syscall === 'write') return;
72-
73-
_error = err
74-
75-
throw err
76-
})
67+
var inErrorState = false;
68+
69+
var $_fatalException = process._fatalException
70+
process._fatalException = function fakeFatalException() {
71+
inErrorState = true;
72+
$_fatalException.apply(this, arguments)
73+
}
7774

7875
process.on('exit', function (code) {
79-
if (_error) {
76+
// let the process exit cleanly.
77+
if (inErrorState) {
8078
return
8179
}
8280

0 commit comments

Comments
 (0)