Skip to content
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

Implement getEnv and getEnvironment #232

Merged
merged 6 commits into from
Aug 10, 2024
Merged

Conversation

hasufell
Copy link
Member

@hasufell hasufell commented May 15, 2024

  • TODO: OsString variant

See haskell/filepath#221

base/ghc implementations: https://hackage.haskell.org/package/ghc-internal-9.1001.0/docs/src//GHC.Internal.System.Environment.html

Base runs two calls to c_GetEnvironmentVariable to get a more accurate allocation. But it's an additional call.

@hasufell hasufell marked this pull request as draft May 15, 2024 17:12
System/Win32/Console.hsc Outdated Show resolved Hide resolved
@hasufell hasufell marked this pull request as ready for review July 22, 2024 14:59
@hasufell
Copy link
Member Author

@Mistuke this is ready for review

@hasufell
Copy link
Member Author

It's possible this needs some adjustment to work across different GHCs (as in filepath/os-string versions).

@hasufell
Copy link
Member Author

It's possible this needs some adjustment to work across different GHCs (as in filepath/os-string versions).

Should be fixed

@Mistuke
Copy link
Contributor

Mistuke commented Aug 6, 2024

@Mistuke this is ready for review

Sorry was on holidays!

Copy link
Contributor

@Mistuke Mistuke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Sorry for the slow review.

wNUL :: CWchar
wNUL = 0

cWcharsToChars :: [CWchar] -> [Char]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

guess we could use decodeMultiByte here. but this works too as it's always UTF-16.

@hasufell
Copy link
Member Author

Anything left to do here?

@Mistuke Mistuke merged commit f3fb024 into haskell:master Aug 10, 2024
1 check failed
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