Skip to content

Commit

Permalink
ci: rework exit code semantics
Browse files Browse the repository at this point in the history
The exit code 1 was previously used to indicate both "update available"
and error. This messes up a bunch of CI tests.

Now the "error" case is moved to exit code 2.
  • Loading branch information
Artoria2e5 committed Oct 23, 2019
1 parent 367ae2e commit db0b350
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ script:
if [[ $nodever == v12 ]]; then
npm run test
else
node ./bin/cli.js
npm run main
fi
6 changes: 4 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ install:
- set CI=true

test_script:
- ver
- node --version
- npm --version
- ps: if ($env:nodejs_version -like '') { npm run lint }
- "node bin/cli.js || ver > null"
- "echo Exit code: %errorlevel%"
- ps: |
node bin/cli.js
if ($LASTEXITCODE -ge 2) { Write-Output "Exit status: $LASTEXITCODE"; exit $LASTEXITCODE } else { Write-Output "All good" }
build: off
shallow_clone: true
Expand Down
2 changes: 1 addition & 1 deletion lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ Promise.resolve()
console.log('For more detail, add `--debug` to the command');
}

process.exit(1);
process.exit(2);
});

const SUPPORTED_INSTALLERS = ['npm', 'pnpm', 'ied', 'yarn'];
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"scripts": {
"lint": "xo ./lib/**/*.js",
"lint:fix": "xo ./lib/**/*.js --fix",
"test": "npm run lint && ./bin/cli.js || { ev=$?; echo \"Exit status: $ev\">&2; exit \"$ev\"; }",
"test": "npm run lint && npm run main",
"main": "./bin/cli.js; ev=$?; if (( ev >= 2 )); then echo \"Exit status: $ev\">&2; exit \"$ev\"; fi" ,
"transpile": "babel lib --out-dir lib-es5",
"watch": "babel lib --out-dir lib-es5 --watch",
"prepare": "npm run transpile"
Expand Down

0 comments on commit db0b350

Please sign in to comment.