Skip to content

Commit

Permalink
fix: CLI fails but exit code is 0
Browse files Browse the repository at this point in the history
Close #2940
  • Loading branch information
develar committed Jun 26, 2018
1 parent 48a0811 commit 2bdfe3a
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"temp-file": "^3.1.2",
"tunnel-agent": "^0.6.0",
"update-notifier": "^2.5.0",
"yargs": "^11.0.0"
"yargs": "^12.0.0"
},
"devDependencies": {
"@babel/core": "^7.0.0-beta.51",
Expand Down
2 changes: 1 addition & 1 deletion packages/electron-builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"read-config-file": "3.0.2",
"sanitize-filename": "^1.6.1",
"update-notifier": "^2.5.0",
"yargs": "^11.0.0",
"yargs": "^12.0.0",
"lazy-val": "^1.0.3",
"electron-builder-lib": "0.0.0-semantic-release",
"electron-download-tf": "4.3.4",
Expand Down
5 changes: 4 additions & 1 deletion packages/electron-builder/src/cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,11 @@ function wrap(task: (args: any) => Promise<any>) {
loadEnv(path.join(process.cwd(), "electron-builder.env"))
.then(() => task(args))
.catch(error => {
console.error(chalk.red(error instanceof InvalidConfigurationError ? error.message : (error.stack || error).toString()))
process.exitCode = 1
// https://github.com/electron-userland/electron-builder/issues/2940
process.on("exit", () => process.exitCode = 1)

console.error(chalk.red(error instanceof InvalidConfigurationError ? error.message : (error.stack || error).toString()))
})
}
}
Expand Down
4 changes: 0 additions & 4 deletions test/out/__snapshots__/BuildTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,8 @@ exports[`build in the app package.json 1`] = `"'build' in the application packag

exports[`cli 1`] = `
Object {
"config": undefined,
"draft": undefined,
"prepackaged": undefined,
"prerelease": undefined,
"projectDir": undefined,
"publish": undefined,
"targets": Map {
Platform {
"buildConfigurationKey": "mac",
Expand Down
27 changes: 27 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5917,6 +5917,10 @@ y18n@^3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41"

"y18n@^3.2.1 || ^4.0.0":
version "4.0.0"
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b"

yallist@^2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52"
Expand All @@ -5925,6 +5929,12 @@ yallist@^3.0.0, yallist@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.0.2.tgz#8452b4bb7e83c7c188d8041c1a837c773d6d8bb9"

yargs-parser@^10.0.0:
version "10.0.0"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-10.0.0.tgz#c737c93de2567657750cb1f2c00be639fd19c994"
dependencies:
camelcase "^4.1.0"

yargs-parser@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-7.0.0.tgz#8d0ac42f16ea55debd332caf4c4038b3e3f5dfd9"
Expand Down Expand Up @@ -5954,6 +5964,23 @@ yargs@^11.0.0:
y18n "^3.2.1"
yargs-parser "^9.0.2"

yargs@^12.0.0:
version "12.0.0"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-12.0.0.tgz#8274480fd7332c77888bc33b6594340d31ed40d3"
dependencies:
cliui "^4.0.0"
decamelize "^1.1.1"
find-up "^2.1.0"
get-caller-file "^1.0.1"
os-locale "^2.0.0"
require-directory "^2.1.1"
require-main-filename "^1.0.1"
set-blocking "^2.0.0"
string-width "^2.0.0"
which-module "^2.0.0"
y18n "^3.2.1 || ^4.0.0"
yargs-parser "^10.0.0"

yargs@^8.0.2:
version "8.0.2"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-8.0.2.tgz#6299a9055b1cefc969ff7e79c1d918dceb22c360"
Expand Down

0 comments on commit 2bdfe3a

Please sign in to comment.