Skip to content

Commit

Permalink
Fixes peggyjs#315. Check isTTY for all output before using colors.
Browse files Browse the repository at this point in the history
  • Loading branch information
hildjj committed Jul 20, 2022
1 parent e654186 commit b48a69f
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions bin/peggy-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ class PeggyCLI extends Command {

/** @type {peggy.BuildOptionsBase} */
this.argv = {};
this.colors = this.std.err.isTTY;
/** @type {string?} */
this.inputFile = null;
/** @type {string?} */
Expand Down Expand Up @@ -386,7 +385,7 @@ class PeggyCLI extends Command {

print(stream, ...args) {
stream.write(util.formatWithOptions({
colors: this.colors,
colors: stream.isTTY,
depth: Infinity,
maxArrayLength: Infinity,
maxStringLength: Infinity,
Expand Down Expand Up @@ -611,12 +610,7 @@ class PeggyCLI extends Command {
opts.startRule = this.progOptions.startRule;
}
const results = exec.parse(this.testText, opts);
this.print(this.std.out, util.inspect(results, {
depth: Infinity,
colors: this.colors,
maxArrayLength: Infinity,
maxStringLength: Infinity,
}));
this.print(this.std.out, results);
}
}

Expand Down

0 comments on commit b48a69f

Please sign in to comment.