Skip to content

Commit a2d42d3

Browse files
spboyerCopilot
andcommitted
Revert non-zero exit for unauthenticated status
Per @vhvb1989 feedback: unauthenticated is a valid result, not a command failure. Non-zero exit should only be for unexpected errors. The expiresOn and LoginGuardMiddleware improvements remain. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 6c73680 commit a2d42d3

1 file changed

Lines changed: 0 additions & 10 deletions

File tree

cli/azd/cmd/auth_status.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,6 @@ func (a *authStatusAction) Run(ctx context.Context) (*actions.ActionResult, erro
117117

118118
if a.formatter.Kind() != output.NoneFormat {
119119
a.formatter.Format(res, a.writer, nil)
120-
if res.Status == contracts.AuthStatusUnauthenticated {
121-
// Return ErrNoCurrentUser so the process exits non-zero.
122-
// The JSON output is already written above; the UX middleware
123-
// skips formatting for JSON output, so this won't double-print.
124-
return nil, auth.ErrNoCurrentUser
125-
}
126120
return nil, nil
127121
}
128122

@@ -157,10 +151,6 @@ func (a *authStatusAction) Run(ctx context.Context) (*actions.ActionResult, erro
157151
"The authentication mode is controlled externally and cannot be changed from within azd.")
158152
}
159153

160-
if res.Status == contracts.AuthStatusUnauthenticated {
161-
return nil, auth.ErrNoCurrentUser
162-
}
163-
164154
return nil, nil
165155
}
166156

0 commit comments

Comments
 (0)