We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8fb4bef commit 51496e5Copy full SHA for 51496e5
Sources/LinuxPlatform/Linux.swift
@@ -543,9 +543,11 @@ public struct Linux: Platform {
543
}
544
545
public func getShell() async throws -> String {
546
+ let userName = ProcessInfo.processInfo.userName
547
+ let prefix = "\(userName):"
548
if let passwds = try await runProgramOutput("getent", "passwd") {
549
for line in passwds.components(separatedBy: "\n") {
- if line.hasPrefix("root:") {
550
+ if line.hasPrefix(prefix) {
551
if case let comps = line.components(separatedBy: ":"), comps.count > 1 {
552
return comps[comps.count - 1]
553
0 commit comments