Skip to content

Support --json errors on railway ssh, so scripts can tell a signed-out account from other failures #1244

Open

Description

@marcospgp

railway ssh exits 1 for every failure and does not accept --json, so a script running it without a terminal can only tell a signed-out account from other failures by matching the message text.

Commands that call set_mode from their --json flag already print {"error", "code", "hint"} with a stable code such as UNAUTHORIZED (src/util/reporter.rs).

Reproduce (CLI 5.62.1, macOS, signed out):

echo | railway ssh --project <id> --service postgres --environment production sh -c true
# exit 1: Unauthorized. Please login with `railway login`

railway ssh --json --project <id> sh -c true
# exit 2: error: unexpected argument '--json' found

src/commands/ssh/mod.rs on master still has no --json flag.

Ask: accept --json on railway ssh and route its errors through the structured output, or give authentication failures their own exit code.

Why: our dev setup copies a database through railway ssh with piped input, and offers railway login when the account is signed out. Today that means matching "Unauthorized".

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