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

setenv invalid description #6

Open
moteus opened this issue Jul 9, 2012 · 3 comments
Open

setenv invalid description #6

moteus opened this issue Jul 9, 2012 · 3 comments

Comments

@moteus
Copy link

moteus commented Jul 9, 2012

For setenv you write that this function set variable only to childe process.
This is not true.
To test

local winapi = require"winapi"
os.execute("git help") -- this call fail
local path = os.getenv("PATH") .. ';c:\\git\\bin'
winapi.setenv("path", path)
os.execute("git help") -- but this pass

getenv create snpshot Environments while load dll and then return same variable.
In my env library i write tests to check all possible variants and os.getenv never get new value,
but GetEnvironmentVariable/getnev(from my dll)/getenv_s/environ return new value. May be on *nix this is not true.

@stevedonovan
Copy link
Owner

OK, that makes sense - os.getenv() is a portable version, but does not fully behave as it should (not an uncommon problem with Windows). So maybe winapi.getenv? Does this matter enough? I agree that the description should be updated.

@moteus
Copy link
Author

moteus commented Jul 9, 2012

I implement 5 functions for env get/set/expand/environ/update.
Update broadcast WM_SETTINGCHANGE like MSDN says, but i can not understand how it work.
You can use my implementation of env functions.

@moteus
Copy link
Author

moteus commented Jul 11, 2012

So maybe winapi.getenv? Does this matter enough?

I use my lib loader that automatically append ENV.PATH before load cmodule to find depedency .dll

local path = path_jopin(LIB_ROOT, 'path')
if dir_exists(path) then
  ENV.PATH = path .. ';' .. ENV.PATH
end

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

No branches or pull requests

2 participants