Skip to content

Commit 283c8e6

Browse files
committed
Handle EPIPE better in exceptional edge cases
Fix #422
1 parent b727234 commit 283c8e6

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

lib/tap.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ const _didPipe = Symbol('_didPipe')
99

1010
const monkeypatchEpipe = () => {
1111
const emit = process.stdout.emit
12-
process.stdout.emit = (ev, er) => {
12+
process.stdout.emit = function (ev, er) {
1313
if (ev !== 'error' || er.code !== 'EPIPE')
14-
return emit.apply(process, arguments)
14+
return emit.apply(process.stdout, arguments)
1515
}
1616
}
1717

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
'use strict'
2+
// See https://github.com/tapjs/node-tap/issues/422
3+
const t = require('../')
4+
t.test('just a lot of asserts in rapid succession', t => {
5+
for (let i = 0; i < 5000; i++) {
6+
t.pass('a number is ' + i)
7+
}
8+
t.end()
9+
})

0 commit comments

Comments
 (0)