Skip to content

Commit d007dc6

Browse files
Fallback to argv[0] for ProcessInfo.processName on platforms without specific APIs. (#1447)
1 parent f6cce78 commit d007dc6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Sources/FoundationEssentials/Platform.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,10 @@ extension Platform {
366366
return String(decodingCString: lpBuffer.baseAddress!, as: UTF16.self)
367367
}
368368
#else
369-
// TODO: Implement for other platforms
370-
return nil
369+
guard let processPath = CommandLine.arguments.first else {
370+
return nil
371+
}
372+
return processPath.lastPathComponent
371373
#endif
372374
}
373375
}

0 commit comments

Comments
 (0)