You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
const fs = require('fs');
const { pipeline } = require('stream')
pipeline(
process.stdin,
fs.createWriteStream("/un-writable-file"),
e => console.error("this should happen")
);
// prints "this should happen"
However, this equivalent, using the promisified version of pipeline doesn't throw the same error:
const fs = require('fs');
const stream = require('stream')
const { promisify } = require('util');
const pipelinePromise = promisify(stream.pipeline);
(async () => {
try {
pipelinePromise(
process.stdin,
fs.createWriteStream("/un-writable-file")
)
}
catch (e) {
console.log("this should happen");
}
})()
// An unhandled exception is thrown. "this should happen" is *not* printed.
I believe that if the error handler was properly called using pipeline(), then the promisified version should behave the same, but with the error being thrown.
The text was updated successfully, but these errors were encountered:
This works as expected:
However, this equivalent, using the promisified version of pipeline doesn't throw the same error:
I believe that if the error handler was properly called using pipeline(), then the promisified version should behave the same, but with the error being thrown.
The text was updated successfully, but these errors were encountered: