Skip to content

Exit with code 1 when CLI credentials are missing - #251

Open
pablotransifex wants to merge 1 commit into
masterfrom
fix/cli-exit-code-on-missing-credentials
Open

pablotransifex wants to merge 1 commit into
masterfrom
fix/cli-exit-code-on-missing-credentials

Conversation

@pablotransifex

@pablotransifex pablotransifex commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #226.

txjs-cli push, pull and invalidate printed "credentials are missing" and then called process.exit(), which exits with code 0. A CI job with wiped credentials therefore stayed green while nothing was pushed.

All three now call this.exit(1). It sets the same exit code as process.exit(1), but oclif throws instead of killing the process, so tests can assert on it. The push "Nothing to upload" path still exits with 0, because an empty push is not a failure.

Tests: I added a missing-credentials test to each command that expects exit code 1. Without the fix, the old process.exit() kills mocha in the middle of the run. With the fix, the full CLI suite passes (56 tests). Running ./bin/run push|pull|invalidate with empty TRANSIFEX_TOKEN/TRANSIFEX_SECRET exits with 1.

Release note: scripts that relied on exit code 0 here will now see a failure, which is the purpose of this fix.

push, pull and invalidate exited with code 0 after reporting missing
credentials, so CI jobs passed while nothing was pushed or pulled.

Fixes #226
@pablotransifex
pablotransifex force-pushed the fix/cli-exit-code-on-missing-credentials branch from 1751e12 to 6885985 Compare November 11, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] CLI exits successfully with code 0 in the case of a fatal missing credentials failure

1 participant