Skip to content

xec command should exit with code 1 for usage/help, not 0 (Unix standard compliance) #294

@lagergren

Description

@lagergren

Problem

The xec command currently exits with code 0 when run without arguments, showing help/usage information. This violates Unix conventions where commands should exit with code 1 when displaying usage due to missing required arguments.

Current Behavior

$ xec
Ecstasy runner:

    Executes an Ecstasy module, compiling it first if necessary.

Usage:

    xec <options> <modulename>
# ... help text ...
$ echo $?
0

Expected Unix Standard Behavior

Commands should exit with code 1 when they cannot perform their primary function due to missing required arguments, even when displaying helpful usage information.

Impact on Homebrew Integration

This non-standard behavior required a workaround in our Homebrew formula test. The test template in .github/actions/update-homebrew-tap/action.yml had to be modified to expect exit code 0 instead of the standard exit code 1:

test do
  # TODO: The exit code test is technically correct to check for 1, but xec doesn't follow the accepted standard
  output = shell_output("#{bin}/xec 2>&1")
  assert_match "Ecstasy runner", output
end

Recommendation

Update xec to exit with code 1 when no module is provided, maintaining Unix standard compliance while still providing helpful usage information.

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