Skip to content

Commit

Permalink
fix: strip ansi chars when using --json
Browse files Browse the repository at this point in the history
  • Loading branch information
lili2311 committed Oct 30, 2019
1 parent 14cdb94 commit 7aaf2df
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { isPathToPackageFile } from '../lib/detect';
import { updateCheck } from '../lib/updater';
import { MissingTargetFileError, FileFlagBadInputError } from '../lib/errors';
import { UnsupportedOptionCombinationError } from '../lib/errors/unsupported-option-combination-error';
import stripAnsi from 'strip-ansi';

const debug = Debug('snyk');
const EXIT_CODES = {
Expand Down Expand Up @@ -59,7 +60,7 @@ async function handleError(args, error) {
const output = vulnsFound ? error.message : error.stack;
console.log(output);
} else if (args.options.json) {
console.log(error.json || error.stack);
console.log(stripAnsi(error.json || error.stack));
} else {
if (!args.options.quiet) {
const result = errors.message(error);
Expand Down

0 comments on commit 7aaf2df

Please sign in to comment.