Skip to content

Commit 56e58c8

Browse files
committed
fix: dont wrap tmux calls with shell
closes #279
1 parent 78db456 commit 56e58c8

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed

lua/image/report.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ local function create_report(state)
3737
add(string.format("TERM: %s", os.getenv("TERM")))
3838
if utils.tmux.is_tmux then
3939
add(string.format("Tmux: %s", utils.tmux.get_version()))
40-
local allow_passthrough = vim.fn.system("tmux show -gv allow-passthrough"):gsub("%s+", "")
40+
local allow_passthrough = vim.fn.system({ "tmux", "show", "-gv", "allow-passthrough" }):gsub("%s+", "")
4141
add(string.format("Tmux Allow Passthrough: %s", allow_passthrough))
42-
local visual_activity = vim.fn.system("tmux show -gv visual-activity"):gsub("%s+", "")
42+
local visual_activity = vim.fn.system({ "tmux", "show", "-gv", "visual-activity" }):gsub("%s+", "")
4343
add(string.format("Tmux Visual Activity: %s", visual_activity))
4444
end
4545
add("```")

lua/image/utils/tmux.lua

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ local is_tmux = vim.env.TMUX ~= nil
22

33
local has_passthrough = false
44
if is_tmux then
5-
local ok, result = pcall(vim.fn.system, "tmux show -Apv allow-passthrough")
5+
local ok, result = pcall(vim.fn.system, { "tmux", "show", "-Apv", "allow-passthrough" })
66
if ok and (result:sub(-3) == "on\n" or result:sub(-4) == "all\n") then has_passthrough = true end
77
end
88

99
local create_dm_getter = function(name)
1010
return function()
1111
if not is_tmux then return nil end
12-
local result = vim.fn.system("tmux display-message -p '#{" .. name .. "}'")
12+
local result = vim.fn.system({ "tmux", "display-message", "-p", "#{" .. name .. "}" })
1313
return vim.fn.trim(result)
1414
end
1515
end
@@ -19,17 +19,33 @@ local get_current_session = create_dm_getter("client_session")
1919
local create_dm_window_getter = function(name)
2020
return function()
2121
if not is_tmux then return nil end
22-
local result =
23-
vim.fn.system("tmux list-windows -t " .. get_current_session() .. " -F '#{" .. name .. "}' -f '#{window_active}'")
22+
local result = vim.fn.system({
23+
"tmux",
24+
"list-windows",
25+
"-t",
26+
get_current_session(),
27+
"-F",
28+
"#{" .. name .. "}",
29+
"-f",
30+
"#{window_active}",
31+
})
2432
return vim.fn.trim(result)
2533
end
2634
end
2735

2836
local create_dm_pane_getter = function(name)
2937
return function()
3038
if not is_tmux then return nil end
31-
local result =
32-
vim.fn.system("tmux list-panes -t " .. get_current_session() .. " -F '#{" .. name .. "}' -f '#{pane_active}'")
39+
local result = vim.fn.system({
40+
"tmux",
41+
"list-panes",
42+
"-t",
43+
get_current_session(),
44+
"-F",
45+
"#{" .. name .. "}",
46+
"-f",
47+
"#{pane_active}",
48+
})
3349
return vim.fn.trim(result)
3450
end
3551
end
@@ -39,7 +55,7 @@ local escape = function(sequence)
3955
end
4056

4157
local get_version = function()
42-
local result = vim.fn.system("tmux -V")
58+
local result = vim.fn.system({ "tmux", "-V" })
4359
return result:match("tmux (%d+%.%d+)")
4460
end
4561

0 commit comments

Comments
 (0)