Skip to content

Console class ignores ignoreErrors on Node.js v14.3.0 #33628

@exoego

Description

@exoego

What steps will reproduce the bug?

  1. 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");
  1. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    streamIssues and PRs related to the stream subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions