Skip to content

xtool uninstall exits 0 when the uninstall fails #354

Open

Description

@rahul05ranjan

xtool uninstall prints the failure and then exits with status 0, so scripts can't tell whether the uninstall actually happened.

Sources/XToolSupport/UninstallCommand.swift:24-33:

do {
    try await installProxy.uninstall(
        bundleID: bundleID,
        progress: { _ in }
    )
} catch {
    print("Failed: \(error)")
    return            // process exits with status 0
}
print("Success!")

Compare xtool install (Sources/XToolSupport/InstallCommand.swift:39-44), xtool dev run (DevCommand.swift:271-276) and xtool dev build --sign (DevCommand.swift:172-177), which all print the error and then throw ExitCode.failure.

The fix is to throw ExitCode.failure in the catch instead of return, matching the other device commands.

Impact: any automation that chains xtool uninstall && xtool install … or gates on the exit code gets success even when the app is still installed (wrong bundle ID given, device connection dropped mid-uninstall, lockdown error, etc.).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions