Skip to content

Commit

Permalink
fix(webpack-cli): handle promise rejection happening with cli-executor (
Browse files Browse the repository at this point in the history
#1269)

* fix: handle promise rejection

* chore: update packages/webpack-cli/lib/utils/cli-executer.js

Co-Authored-By: Anshuman Verma <[email protected]>

* feat: colorize suggestion

Co-authored-by: Emanuele <[email protected]>
Co-authored-by: Anshuman Verma <[email protected]>
  • Loading branch information
3 people authored Feb 28, 2020
1 parent edd428b commit afe97f6
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/webpack-cli/lib/utils/cli-executer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const { MultiSelect, Input } = require('enquirer');
const chalk = require('chalk');
const runner = require('../runner');
const logger = require('./logger');
const cliArgs = require('./cli-flags').core;
Expand Down Expand Up @@ -50,10 +51,14 @@ async function prompter() {
}

async function run() {
const args = await prompter();
process.stdout.write('\n');
logger.info(`Executing CLI\n`);
runner([], args);
try {
const args = await prompter();
process.stdout.write('\n');
logger.info(`Executing CLI\n`);
runner([], args);
} catch (err) {
logger.error(`Action Interrupted, use ${chalk.cyan(`webpack-cli help`)} to see possible options.`)
}
}

module.exports = run;

0 comments on commit afe97f6

Please sign in to comment.