You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
HandleExitCoder does not see an ExitCoder wrapped with %w #2478
HandleExitCoder looks for an ExitCoder (and for a MultiError) with a bare type assertion, so an exit error that has been wrapped with fmt.Errorf("%w") is not recognised. Nothing calls OsExiter and nothing is written to ErrWriter; the process then exits with the default code 1.
Running that command prints nothing, and the exit code is 1 instead of 9.
Why it matters
Exit documents that the underlying error stays reachable through the standard wrapping helpers, and exitError implements Unwrap() (that is what #1090 and #2444 added). Adding context to an Action error with %w is the ordinary way to do it, and the only consumer of that promise — HandleExitCoder — did not follow.
The same happens inside a MultiError: the last exit code is read with a bare assertion, so newMultiError(errors.New("wowsa"), fmt.Errorf("...: %w", Exit("boom", 11))) exits with 1 instead of 11.
Expected
A wrapped ExitCoder should be handled exactly like an unwrapped one: the message goes to ErrWriter, OsExiter is called, and the exit code is preserved.
Environment
urfave/cli v3 (main), Go 1.27.1 on Windows. Reproduced on 2026-10-19.
Activity
fix: keep the exit code and message of a wrapped ExitCoder