"premature close" error when calling destroy on source stream
- Dominant language
- JavaScript
- Stars
- 917
- Forks
- 64
- PR merge metrics
- No merged PRs in 30d
Description
I am using node js 8.* and it has new method `destroy` for Readable streams.
https://nodejs.org/docs/latest-v8.x/api/stream.html#stream_readable_destroy_error
The following is generating `premature close` error coming from `end-of-stream` module.
```
var pump = require('pump')
var fs = require('fs')
var source = fs.createReadStream('/dev/random')
var dest = fs.createWriteStream('/dev/null')
pump(source, dest, function(err) {
console.log('pipe finished', err)
})
setTimeout(function() {
source.destroy();
}, 1000)
```
Any ideas?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the provided Node.js 8 reproduction, then trace the pump entry point into the end-of-stream module where the “premature close” error originates. Determine the expected callback behavior when source.destroy() is called and verify the result against the reproduction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100