Skip to content

Commit

Permalink
Don't overwrite process.stderr.write without restoring it later
Browse files Browse the repository at this point in the history
This was probably not a very good idea.
  • Loading branch information
nylen committed Jan 16, 2015
1 parent c08e77b commit b27582a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tests/test-node-debug.js
Expand Up @@ -12,11 +12,12 @@ var s = http.createServer(function(req, res) {
var stderr = []
, prevStderrLen = 0

process.stderr.write = function(string, encoding, fd) {
stderr.push(string)
}

tape('setup', function(t) {
process.stderr._oldWrite = process.stderr.write
process.stderr.write = function(string, encoding, fd) {
stderr.push(string)
}

s.listen(6767, function() {
t.end()
})
Expand Down Expand Up @@ -83,6 +84,9 @@ tape('it should be possible to disable debugging at runtime', function(t) {
})

tape('cleanup', function(t) {
process.stderr.write = process.stderr._oldWrite
delete process.stderr._oldWrite

s.close(function() {
t.end()
})
Expand Down

0 comments on commit b27582a

Please sign in to comment.