-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
createWriteStream on Ubuntu not using default autoClose option #17951
Comments
How do you call it? Please post a standalone code example. |
Here you go: const FS = require('fs');
const zlib = require('zlib');
const gzip = zlib.createGzip();
const inputStream = FS.createReadStream('./file.txt');
const outputStream = FS.createWriteStream('./output.gz');
outputStream.on('finish', function () {
outputStream.close();
// Perform other logic as well
});
inputStream.pipe(gzip).pipe(outputStream); This code block did not work on my Mac as well. I am calling the On Ubuntu, one of my team mate was able to solve the error by changing adding the Also, the project has been in service for 1+ years without errors so it could be that there are some API changes I missed when I upgraded node to v9. |
Thanks. Just so we're on the same page, can you post the full stack trace that you got? edit: that said, I suspect e5c290b is responsible for what you're seeing. |
@bnoordhuis I try to reproduce the error, This is what i got on Ubuntu:
|
@timotew Thanks! @mcollina Looks like e5c290b#diff-9a205ef7ee967ee32efee02e58b3482dR2275 needs an additional type check. |
@bnoordhuis yes indeed! I'll work on a fix tomorrow. |
I get the same error as @timotew . Thanks for identifying the cause! |
Refactor WriteStream.prototype.close and WriteStream.prototype._destroy to always call the callback passed to close in order. Protects from calling .close() without a callback. Fixes: nodejs#17951 See: nodejs#15407
Refactor WriteStream.prototype.close and WriteStream.prototype._destroy to always call the callback passed to close in order. Protects from calling .close() without a callback. Fixes: #17951 See: #15407 PR-URL: #18002 Fixes: #17951 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
Refactor WriteStream.prototype.close and WriteStream.prototype._destroy to always call the callback passed to close in order. Protects from calling .close() without a callback. Fixes: #17951 See: #15407 PR-URL: #18002 Fixes: #17951 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
The fix will be released in 9.4.0. |
I am using
createWriteStream
in my code which throws the following error on Ubuntu:Adding the
autoClose
option solves this error. The docs mention thatautoClose=true
by default so not sure why I had to explicitly specify it again.The code does not throw error when running on mac 10.12.6 with node 9.2.1 and 9.3.0.
The code works without any errors on Ubuntu 16.04 when using node 8.9.3. Looks like something changed after 8.9.3 for the Ubuntu build which is causing this issue.
The text was updated successfully, but these errors were encountered: