Skip to content

feat(cli): exit with status 4 when the permission prompt is declined - #154

Open
mendez-11 wants to merge 1 commit into
flock-php:mainfrom
mendez-11:fix/25-declined-exit-status
Open

mendez-11 wants to merge 1 commit into
flock-php:mainfrom
mendez-11:fix/25-declined-exit-status

Conversation

@mendez-11

Copy link
Copy Markdown

Fixes #25

What changed

  • CLI: flock install and flock uninstall exit with 4 when the administrator password or permission prompt is declined (on macOS, Linux and Windows), instead of 1. errDeclined and the new ExitCode live in internal/cli/exitcodes.go; cmd/flock/main.go exits with cli.ExitCode(err). 3 is already taken by exitNotWorktree and exitAlreadyRunning, and pkexec uses 126/127, so the next free code is 4. The message printed in the terminal is unchanged.
  • macOS app: Installation.Result keeps the process's status; permissionDeclined is status == 4. The uninstall sheet uses permissionDeclined instead of matching the text.
  • Linux app: Output keeps the exit code; declined() is code == Some(4).
  • Windows app: Installation.Result keeps the ExitCode that CliProcessRunner already reports; the setup window uses PermissionDeclined instead of matching the text.
  • Docs: docs/cli.md documents the exit statuses of flock install and flock uninstall.

Tests

  • Go: TestExitCode (declined, declined and wrapped, another error, and the same text without errDeclined).
  • macOS, Linux and Windows: a declined result goes by the exit status, and the same message with status 1 isn't counted as declined.

Run locally (macOS, Apple silicon): make lint, make test, GOOS=windows go vet ./..., GOOS=linux go vet ./..., swift build / swift test --package-path macos, cargo fmt --check and go run ./tools/docslint. The Linux app (GTK) and the Windows app (net10.0-windows) can't build on macOS, so their build and tests are left to CI.

flock install and flock uninstall exit with 4 when the administrator password or permission prompt is declined, instead of 1. The macOS, Linux and Windows apps read the exit status instead of matching the English message, which is unchanged.

This branch has not been deployed

No deployments
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.

flock-php install: report a declined permission prompt with an exit status, not text the apps match

1 participant