Skip to content

proxy start falls back to port 1355 and exits 0 when sudo fails, breaking scripted use #392

Description

@itsjamie

When proxy start needs the privileged port and sudo fails or is declined, it falls back to port 1355 and exits 0. For interactive use that is a fine default. For scripted use it is a trap: our repo chains portless proxy start && turbo run dev, and on a declined prompt (or any non-TTY context where sudo cannot ask) the chain continues into a stack whose configured URLs all point at :443, where nothing listens. It is also sticky, because the next proxy start finds the 1355 proxy and reports success.

Reproduce on 0.15.5:

portless proxy stop
sudo -k
portless proxy start     # decline the prompt
echo $?                  # 0, proxy is on 1355

We work around it by pinning the port, portless proxy start --port 443, which takes the explicit-port branch and correctly exits 1 on a sudo failure. That works, but it means the safe behaviour is only reachable by knowing the internals.

Could a sudo failure without an explicit port be made fatal (or gated behind a --no-fallback flag for script use)? And whichever way that lands, the guidance printed at that moment should be the privileged re-run, since following the -p 1355 suggestion reproduces the state the message is trying to get the user out of.

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