Skip to content

Commit

Permalink
fix(vfox clink): clink coroutine execution failed (#410)
Browse files Browse the repository at this point in the history
In clink v1.7.8, when coroutine.resume(vfox_task) is used to resume the coroutine, the internal command cannot be executed successfully.
  • Loading branch information
jan-bar authored Feb 14, 2025
1 parent dad777b commit e1f3f56
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions internal/shell/clink_vfox.lua
Original file line number Diff line number Diff line change
Expand Up @@ -134,28 +134,27 @@ local vfox_setenv = function(str)
end
end

local vfox_filter = function() end
local vfox_task = coroutine.create(function()
os.setenv('__VFOX_PID', os.getpid())
os.setenv('__VFOX_CURTMPPATH', nil)
local vfox_activate = io.popen('vfox activate clink')
for line in vfox_activate:lines() do
vfox_setenv(line)
end
vfox_activate:close()

local cleanup = coroutine.create(function()
os.execute('vfox env -c')
end)
coroutine.resume(cleanup)
end)
coroutine.resume(vfox_task)

local vfox_prompt = clink.promptfilter(30)
function vfox_prompt:filter(prompt)
clink.promptcoroutine(function()
os.execute('vfox env -c')
vfox_filter = function()
local env = io.popen('vfox env -s clink')
for line in env:lines() do
vfox_setenv(line)
end
env:close()
end)
end
end)
clink.runcoroutineuntilcomplete(vfox_task)

local vfox_prompt = clink.promptfilter(30)
function vfox_prompt:filter()
clink.promptcoroutine(vfox_filter)
end

0 comments on commit e1f3f56

Please sign in to comment.