Skip to content

Commit 0c58580

Browse files
committed
fix: use logger for error with proper exit code
1 parent 8651f49 commit 0c58580

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

packages/webpack-cli/lib/utils/resolve-command.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const run = async (name, ...args) => {
1717
});
1818
} catch (err) {
1919
logger.error(`Action Interrupted, use ${cyan('webpack-cli help')} to see possible commands.`);
20+
process.exit(2);
2021
}
2122
}
2223

packages/webpack-cli/lib/utils/run-command.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const execa = require('execa');
2+
const logger = require('./logger');
23

34
async function runCommand(command, args = []) {
45
try {
@@ -7,7 +8,8 @@ async function runCommand(command, args = []) {
78
shell: true,
89
});
910
} catch (e) {
10-
throw new Error(e);
11+
logger.error(e);
12+
process.exit(2);
1113
}
1214
}
1315

0 commit comments

Comments
 (0)