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

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

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
where
-- according to https://learn.microsoft.com/en-us/windows/win32/api/processenv/nf-processenv-getenvironmentvariablew
maxLength :: Int
maxLength = 32767
Copy link
Member Author

Choose a reason for hiding this comment

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

Documentation says "characters". Do they mean wide chars? Then we have to *2 this, I guess.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, the buffer size is 16-bits, so 2^16-1 bytes.

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.

None yet

2 participants