Skip to content

Commit

Permalink
console: make variables and checks stricter
Browse files Browse the repository at this point in the history
PR-URL: #17707
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
BridgeAR authored and MylesBorins committed Jan 9, 2018
1 parent 0573c0f commit 41e2bb1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/console.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function Console(stdout, stderr, ignoreErrors = true) {
Object.defineProperty(this, '_stdout', prop);
prop.value = stderr;
Object.defineProperty(this, '_stderr', prop);
prop.value = ignoreErrors;
prop.value = Boolean(ignoreErrors);
Object.defineProperty(this, '_ignoreErrors', prop);
prop.value = new Map();
Object.defineProperty(this, '_times', prop);
Expand Down Expand Up @@ -80,7 +80,7 @@ function createWriteErrorHandler(stream) {
// This conditional evaluates to true if and only if there was an error
// that was not already emitted (which happens when the _write callback
// is invoked asynchronously).
if (err && !stream._writableState.errorEmitted) {
if (err !== null && !stream._writableState.errorEmitted) {
// If there was an error, it will be emitted on `stream` as
// an `error` event. Adding a `once` listener will keep that error
// from becoming an uncaught exception, but since the handler is
Expand All @@ -102,7 +102,7 @@ function write(ignoreErrors, stream, string, errorhandler, groupIndent) {
}
string += '\n';

if (!ignoreErrors) return stream.write(string);
if (ignoreErrors === false) return stream.write(string);

// There may be an error occurring synchronously (e.g. for files or TTYs
// on POSIX systems) or asynchronously (e.g. pipes on POSIX systems), so
Expand Down

0 comments on commit 41e2bb1

Please sign in to comment.