What steps will reproduce the bug?
- Create a
repro.js which contents is below:
ws = require('fs').createWriteStream('./foo.log');
ws.destroy();
c = new require('console').Console({
stdout: ws,
stderr: ws,
ignoreErrors: false
});
c.log("should fail");
- Run
ndoe repro.js
How often does it reproduce? Is there a required condition?
Every time it reproduces on the above environment with the above procedure.
What is the expected behavior?
Invoking c.log should throw error, since the underlying streams are already destroyed, like below:
events.js:287
throw er; // Unhandled 'error' event
^
Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed
Note) The expected errors are thrown on Node.js v12.16.3 and v10.20.1.
What do you see instead?
No errors thrown, and script runs succesfully.
It seems that Console class ignores ignorErrors option.