fix(agent/usershell): check shell on darwin via dscl (#8366)

This commit is contained in:
Mathias Fredriksson
2023-07-11 20:27:50 +03:00
committed by GitHub
parent de1d04d7bb
commit e508d9aa6e
4 changed files with 70 additions and 31 deletions
+4 -1
View File
@@ -27,5 +27,8 @@ func Get(username string) (string, error) {
}
return parts[6], nil
}
return "", xerrors.Errorf("user %q not found in /etc/passwd", username)
if s := os.Getenv("SHELL"); s != "" {
return s, nil
}
return "", xerrors.Errorf("shell for user %q not found in /etc/passwd or $SHELL", username)
}