aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/outcome/hsu.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/outcome/hsu.go')
-rw-r--r--internal/outcome/hsu.go10
1 files changed, 4 insertions, 6 deletions
diff --git a/internal/outcome/hsu.go b/internal/outcome/hsu.go
index 118fd681..ecb616c0 100644
--- a/internal/outcome/hsu.go
+++ b/internal/outcome/hsu.go
@@ -51,18 +51,16 @@ func (h *Hsu) ID() (int, error) {
cmd.Stderr = os.Stderr // pass through fatal messages
cmd.Env = make([]string, 0)
cmd.Dir = fhs.Root
- var (
- p []byte
- exitError *exec.ExitError
- )
-
+ var p []byte
const step = "obtain uid from hsu"
if p, h.idErr = h.k.cmdOutput(cmd); h.idErr == nil {
h.id, h.idErr = strconv.Atoi(string(p))
if h.idErr != nil {
h.idErr = &hst.AppError{Step: step, Err: h.idErr, Msg: "invalid uid string from hsu"}
}
- } else if errors.As(h.idErr, &exitError) && exitError != nil && exitError.ExitCode() == 1 {
+ } else if exitError, ok := errors.AsType[*exec.ExitError](h.idErr); ok &&
+ exitError != nil &&
+ exitError.ExitCode() == 1 {
// hsu prints an error message in this case
h.idErr = &hst.AppError{Step: step, Err: ErrHsuAccess}
} else if errors.Is(h.idErr, os.ErrNotExist) {