Skip to content

TSCBasic: alter environment handling for Windows #317

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 12, 2022

Conversation

compnerd
Copy link
Member

Rather than using the unicode environment, which should be preferred,
use the ANSI environment operations. This is important to do here as
the reading of the environment relies on Foundation, which in turn
relies on CoreFoundation for _CFEnviron which returns the ANSI
environment. As a result, we need to ensure that we use the ANSI
environment variables through out as the C runtime will maintain the two
environments in parallel and may go out of sync.

This will enable additional tests in Swift Package Manager to pass on
Windows, but should really be addressed by changing Foundation to use
the Unicode environment variables and then using that once more here.

Rather than using the unicode environment, which should be preferred,
use the ANSI environment operations.  This is important to do here as
the reading of the environment relies on Foundation, which in turn
relies on CoreFoundation for `_CFEnviron` which returns the ANSI
environment.  As a result, we need to ensure that we use the ANSI
environment variables through out as the C runtime will maintain the two
environments in parallel and may go out of sync.

This will enable additional tests in Swift Package Manager to pass on
Windows, but should really be addressed by changing Foundation to use
the Unicode environment variables and then using that once more here.
@compnerd
Copy link
Member Author

@swift-ci please test

@neonichu
Copy link
Contributor

the C runtime will maintain the two environments in parallel and may go out of sync.

😱

@tomerd
Copy link
Contributor

tomerd commented May 12, 2022

@compnerd is there a unit test we can add here?

@compnerd
Copy link
Member Author

compnerd commented May 12, 2022

Likely; however, it would be of little value - t-s-c tests don't run on windows yet. This actually was something that was caught through the SPM test suite.

https://github.com/apple/swift-tools-support-core/blob/main/Tests/TSCBasicTests/ProcessEnvTests.swift
Seems to cover it already in this repo.

@tomerd tomerd merged commit 3ddceee into swiftlang:main May 12, 2022
@compnerd compnerd deleted the ansi-is-the-new-unicode branch May 16, 2022 15:19
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.

3 participants