Skip to content

CLI returns exit code 0 even on errors — breaks scripting #10

@TheTrustedAdvisor

Description

@TheTrustedAdvisor

Problem

The main() function (line 3002-3005) always exits with code 0, regardless of whether the command succeeded or failed:

def main():
    parser = build_parser()
    args = parser.parse_args()
    args.func(args)  # No return value checked, no sys.exit()

All cmd_* functions print error messages but return None. This means:

tmx login --email wrong@example.com && echo "Login successful!"
# Prints "❌ Login fehlgeschlagen" AND "Login successful!" — exit code is always 0

This breaks shell scripting, CI/CD pipelines, and AI-agent tool use where the exit code determines success/failure.

Proposed Fix

Have cmd_* functions return a boolean or use sys.exit(1) on errors:

def main():
    parser = build_parser()
    args = parser.parse_args()
    result = args.func(args)
    if result is False:
        sys.exit(1)

Then update each cmd_* function to return False on error paths (where they currently just print("❌ ...") and return).

Impact

  • Severity: MEDIUM (affects scripting and programmatic use)
  • Effort: Low (add return False to error paths in each cmd function)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions