wezterm
wezterm copied to clipboard
Unable to get environment variables under wezterm, resulting in command unavailable
What Operating System(s) are you seeing this problem on?
macOS
Which Wayland compositor or X11 Window manager(s) are you using?
No response
WezTerm version
wezterm 20240624-065522-552bb1d6
Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?
Yes, and I updated the version box above to show the version of the nightly that I tried
Describe the bug
In wezterm.lua environment can not get environment variables, resulting in a command, can not be used directly
To Reproduce
local wezterm = require 'wezterm'
function shell(cmd)
local output = "null"
local f = io.popen(cmd)
if f ~= nil then
output = f:read("*all")
f:close()
end
return output
end
-- Unable to set or get environment variables
wezterm.log_info('shell: ' .. shell("echo $PATH"))
wezterm.log_info('os: ' ..os.getenv("PATH"))
-- Some shell commands cannot be used, such as:
wezterm.log_info('node -v: ' .. shell("node -v"))
return {
font_size = 17.0,
font = wezterm.font_with_fallback {
{family = 'JetBrains Mono'},
'Noto Color Emoji'
},
keys = {{
key = 'g',
mods = 'CTRL',
action = wezterm.action.ShowDebugOverlay
}}
}
Configuration
You can execute shell directly in wezterm.lua
Expected Behavior
No response
Logs
No response
Anything else?
No response