fix: propagate non-zero exit codes from deploy client#989
Open
LongOddCode wants to merge 4 commits intomainfrom
Open
fix: propagate non-zero exit codes from deploy client#989LongOddCode wants to merge 4 commits intomainfrom
LongOddCode wants to merge 4 commits intomainfrom
Conversation
The deploy command silently ignored failures from the StaticSitesClient binary. When the binary crashed (e.g., missing native dependencies on slim Docker images), the CLI reported success and exited with code 0. This fix: - Adds stderr handler to capture binary error output - Adds else branch for non-zero exit codes with diagnostic message - Calls process.exit(1) on failure so CI/CD detects it Fixes #536, #594 Refs: ICM 21000000909499
- stderr is captured and passed to logger.error - Non-zero exit code triggers spinner.fail and error message - process.exit(1) is called on binary failure - Success path (exit code 0) remains unchanged
The ReturnType<typeof vi.spyOn> didn't match the 'never' return type of process.exit, causing tsc to fail in CI format check.
The deploy e2e CI uses --dry-run with a dummy token, which causes StaticSitesClient to fail with BadRequest. In dry-run mode, binary failures should be logged but not cause process.exit(1). Added test: 'should not call process.exit(1) in dry-run mode'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #665
The deploy() function spawned the deploy client binary (StaticSitesClient) but never awaited the child process. The close event handler ran in a fire-and-forget callback, so a non-zero exit code was silently ignored and the function always resolved — making CI/CD pipelines believe deployment succeeded even when it failed.
Changes
src/cli/commands/deploy/deploy.ts
src/cli/commands/deploy/deploy-exit-code.spec.ts (NEW)