-
-
Couldn't load subscription status.
- Fork 33.6k
Closed
Labels
streamIssues and PRs related to the stream subsystem.Issues and PRs related to the stream subsystem.
Description
- Version: 8.9.4
- Platform: Linux brunhilde 4.14.9-1-ARCH deps: update openssl to 1.0.1j #1 SMP PREEMPT Tue Dec 26 00:18:37 UTC 2017 x86_64 GNU/Linux
- Subsystem: streams
Running the below example
var stream = require('stream')
var t = stream.Transform({
transform: function (data, enc, cb) {
console.log(`transform destroyed=${this._readableState.destroyed}`)
cb(null)
},
flush: function (cb) {
console.log(`flush destroyed=${this._readableState.destroyed}`)
cb(null)
}
})
t.on('close', function () {
console.log('onclose')
})
t.on('error', function () {
console.log('onerror')
})
t.on('end', function () {
console.log('onend')
})
t.on('finish', function () {
console.log('onfinish')
})
t.resume()
t.write('a')
t.write('b')
t.write('c')
t.destroy(new Error('error'))... I get the following output
transform destroyed=false
transform destroyed=false
transform destroyed=false
flush destroyed=true
onfinish
onend
onclose
onerror
The order of events here seem wrong (similar to #18171) as I would expect error to come before finish/end.
It also seems wrong that flush is called even though the stream has been destroyed.
Metadata
Metadata
Assignees
Labels
streamIssues and PRs related to the stream subsystem.Issues and PRs related to the stream subsystem.