Skip to content

Conversation

@iCharlesHu
Copy link
Contributor

The original NSProcessInfo implementation calls _CFProcessPath for processName, which Platform.getFullExecutablePath internally calls. We should maintain the same behavior for binary compatibility.

….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.
@iCharlesHu
Copy link
Contributor Author

@swift-ci please test

@iCharlesHu iCharlesHu changed the title Bin compat: use Platform.getFullExecutablePath instead of CommandLinearguments.first for ProcessInfo.processName. Bin compat: use Platform.getFullExecutablePath instead of CommandLine.arguments.first for ProcessInfo.processName. Jul 9, 2025
@iCharlesHu
Copy link
Contributor Author

@swift-ci please test

@iCharlesHu iCharlesHu merged commit 64fff9d into swiftlang:main Jul 11, 2025
16 checks passed
@iCharlesHu iCharlesHu deleted the charles/process-info-process-name branch July 11, 2025 17:22
kateinoigakukun added a commit to kateinoigakukun/swift-foundation that referenced this pull request Jul 19, 2025
…out specific APIs.

WASI does not provide a specific API to retrieve the process name,
so we used `CommandLine.arguments.first` for `ProcessInfo.processName`.
After swiftlang#1411, `CommandLine.arguments.first` started using platform-specific
APIs to retrieve the process name, but the fallback path with `argv[0]`
was removed. This commit restores that fallback for platforms like WASI.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants