Skip to content

Fix package command returning exit code 0 on build failure#76

Draft
shanerbaner82 wants to merge 1 commit intomainfrom
fix/package-command-exit-codes
Draft

Fix package command returning exit code 0 on build failure#76
shanerbaner82 wants to merge 1 commit intomainfrom
fix/package-command-exit-codes

Conversation

@shanerbaner82
Copy link
Copy Markdown
Contributor

Summary

  • handle() returned void, so native:package always exited with code 0 — even when Gradle failed or no output file was produced. CI (Bifrost) had no way to detect build failures via exit code.
  • Gradle output was swallowed in --no-tty mode because Process::run() captured stdout but nothing printed it — builds appeared to hang then silently succeed.
  • handleBuildArtifacts() returning null (no AAB/APK found) was never checked — the command printed "Signed bundle build complete" regardless.

Changes

  • handle() returns int (1 on error, 0 on success)
  • buildAndroid() returns bool so handle() can propagate failure
  • Added check: if handleBuildArtifacts() returns null, error and return false
  • Added output callback to Process::run() so Gradle output streams in real-time during --no-tty builds

Test plan

  • Run php artisan native:package android --build-type=bundle --no-tty — confirm Gradle output streams to terminal
  • Break build.gradle.kts and run package — confirm command exits with code 1
  • Run successful build — confirm exit code 0, AAB produced, output shown
  • Trigger Bifrost CI build — confirm failed builds now report as failed

The native:package command returned void from handle(), causing the
process to always exit 0 even when builds failed. This caused CI
systems (Bifrost) to report successful builds when Gradle silently
failed and produced no output file.

Three fixes:
- handle() returns int (1 on error, 0 on success)
- buildAndroid() returns bool and checks handleBuildArtifacts() result
- Gradle output streams to stdout in --no-tty mode via process callback

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@shanerbaner82 shanerbaner82 marked this pull request as draft March 31, 2026 02:18
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.

1 participant