diff --git a/Sources/LinuxPlatform/Linux.swift b/Sources/LinuxPlatform/Linux.swift index 824786f2..c897a197 100644 --- a/Sources/LinuxPlatform/Linux.swift +++ b/Sources/LinuxPlatform/Linux.swift @@ -543,9 +543,11 @@ public struct Linux: Platform { } public func getShell() async throws -> String { + let userName = ProcessInfo.processInfo.userName + let prefix = "\(userName):" if let passwds = try await runProgramOutput("getent", "passwd") { for line in passwds.components(separatedBy: "\n") { - if line.hasPrefix("root:") { + if line.hasPrefix(prefix) { if case let comps = line.components(separatedBy: ":"), comps.count > 1 { return comps[comps.count - 1] }