-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
fs: read/write streams don't emit close
after error
#23338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
close
after error
close
after error
Can you please provide a code to reproduce? |
const fs = require('fs')
fs.createReadStream('this file does not exist')
.on('error', err => {
console.log('error', err)
})
.on('close', () => {
// Will not be called
console.log('close')
}) |
ping @mcollina |
This is definitely soemthing we would like to do. cc @mafintosh |
I would like to try to fix this but I need some guidance. Is it just a matter of emitting a I was thinking that if a file doesn't exist, |
You would think that. However, the stream API (as far as I understand it) needs to emit |
I believe so. |
The solution to this should be based on #22795 ( |
Ok, I'll take a look at this |
@mcollina If the solution is to be based on |
If |
@mcollina If I understood it correctly, I did moved the code to use
I'm sure, I'm missing something here. Also, there is already a property called |
@mcollina Friendly remainder 🔉 |
@antsmartian can you please open full PR so I can do a proper review? Some quick notes:
|
@mcollina Sure, will raise a PR. I didn't write test cases, thats the reason I didn't raise PR. Will do, once I'm done with those changes. With respect to:
I initially thought that, |
If you wish, you can open the PR and put |
@Trott Yes, but looks like my initial understanding is wrong. So I need to pick up from the above comment provided. Will try to see if I can pull out things. But other's are free to open up a PR, in the meantime :) |
I believe this has been resolved. |
No description provided.
The text was updated successfully, but these errors were encountered: