Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Sources/LinuxPlatform/Linux.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
Expand Down
Loading