Skip to content

Commit

Permalink
fix: use logger for error with proper exit code
Browse files Browse the repository at this point in the history
  • Loading branch information
snitin315 committed Nov 9, 2020
1 parent 8651f49 commit 0c58580
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/webpack-cli/lib/utils/resolve-command.js
Expand Up @@ -17,6 +17,7 @@ const run = async (name, ...args) => {
});
} catch (err) {
logger.error(`Action Interrupted, use ${cyan('webpack-cli help')} to see possible commands.`);
process.exit(2);
}
}

Expand Down
4 changes: 3 additions & 1 deletion packages/webpack-cli/lib/utils/run-command.js
@@ -1,4 +1,5 @@
const execa = require('execa');
const logger = require('./logger');

async function runCommand(command, args = []) {
try {
Expand All @@ -7,7 +8,8 @@ async function runCommand(command, args = []) {
shell: true,
});
} catch (e) {
throw new Error(e);
logger.error(e);
process.exit(2);
}
}

Expand Down

0 comments on commit 0c58580

Please sign in to comment.