Fix error handling for extension and shell alias commands (#7567)
This commit is contained in:
parent
8587851202
commit
9be9dc22e9
3 changed files with 18 additions and 3 deletions
|
|
@ -109,7 +109,7 @@ func mainRun() exitCode {
|
|||
if cmd, err := rootCmd.ExecuteContextC(ctx); err != nil {
|
||||
var pagerPipeError *iostreams.ErrClosedPagerPipe
|
||||
var noResultsError cmdutil.NoResultsError
|
||||
var execError *exec.ExitError
|
||||
var extError *root.ExternalCommandExitError
|
||||
var authError *root.AuthError
|
||||
if err == cmdutil.SilentError {
|
||||
return exitError
|
||||
|
|
@ -130,8 +130,9 @@ func mainRun() exitCode {
|
|||
}
|
||||
// no results is not a command failure
|
||||
return exitOK
|
||||
} else if errors.As(err, &execError) {
|
||||
return exitCode(execError.ExitCode())
|
||||
} else if errors.As(err, &extError) {
|
||||
// pass on exit codes from extensions and shell aliases
|
||||
return exitCode(extError.ExitCode())
|
||||
}
|
||||
|
||||
printError(stderr, err, cmd, hasDebug)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue