Commit 434785d3 authored by Phil Hagelberg's avatar Phil Hagelberg

Don't copy env table around so much.

This allows our completion logic (which lives at the top-level of
session.lua) to see the changes to env.CWD when you change
directories. However, it also means we can't trust env.USER to be
accurate when doing permissions checks, so we should probably fix
that! At some point, I mean.
parent 73d6517d
-- -*- lua -*-
local orig_env, args = ...
local env = lume.merge({}, orig_env)
local env, args = ...
local interp = function(s, tab)
return (s:gsub('($%b{})', function(w) return tab[w:sub(3, -2)] or w end))
......@@ -12,8 +12,7 @@ shell.new_env = function(user, host)
USER = user, HOST = host }
shell.exec = function(orig_env, command, extra_sandbox)
local env = lume.merge({}, orig_env)
shell.exec = function(env, command, extra_sandbox)
local args = lume.array((command.." "):gmatch("(.-)( +)"))
local executable_name = table.remove(args, 1)
local try_run = function(executable_path)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment