Skip to content

Commit 37c8705

Browse files
committed
Bin compat: use Platform.getFullExecutablePath instead of CommandLine.arguments.first for ProcessInfo.processName.
The original NSProcessInfo implementation calls _CFProcessPath for processName, which Platform.getFullExecutablePath internally calls. We should maintain the same behavior for binary compatibility.
1 parent 5cdd221 commit 37c8705

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

Sources/FoundationEssentials/ProcessInfo/ProcessInfo.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -597,10 +597,7 @@ extension _ProcessInfo {
597597
}
598598

599599
private static func _getProcessName() -> String {
600-
guard let processPath = CommandLine.arguments.first else {
601-
return ""
602-
}
603-
return processPath.lastPathComponent
600+
return Platform.getFullExecutablePath()?.lastPathComponent ?? ""
604601
}
605602

606603
#if os(macOS)

0 commit comments

Comments
 (0)