fix(runner): use sh -c wrapper for safe command execution

This commit is contained in:
NicolasGB
2025-12-19 16:57:38 +10:00
parent 868c3ce2e1
commit 5dc6fbafa7
2 changed files with 4 additions and 5 deletions
+2 -3
View File
@@ -25,11 +25,10 @@ local status_module = require("jj.cmd.status")
--- @field close_on_edit? boolean Whether to close the log buffer when editing a change
--- @class jj.cmd.log.keymaps
--- @field checkout? string|string[] Keymaps for the log command buffer, setting a keymap to nil will disable it
--- @field checkout_immutable? string|string[]
--- @field edit? string|string[] Keymaps for the log command buffer, setting a keymap to nil will disable it
--- @field edit_immutable? string|string[]
--- @field describe? string|string[]
--- @field diff? string|string[]
--- @field edit? string|string[]
--- @field new? string|string[]
--- @field new_after? string|string[]
--- @field new_after_immutable? string|string[]
+2 -2
View File
@@ -9,7 +9,7 @@ local M = {}
--- @return string|nil output The command output, or nil if failed
--- @return boolean success Whether the command succeeded
function M.execute_command(cmd, error_prefix, input, silent)
local output = vim.fn.system(cmd, input)
local output = vim.fn.system({ "sh", "-c", cmd }, input)
local success = vim.v.shell_error == 0
if not success then
@@ -38,7 +38,7 @@ end
function M.execute_command_async(cmd, on_success, error_prefix, input, silent)
local output_lines = {}
local job_id = vim.fn.jobstart(cmd, {
local job_id = vim.fn.jobstart({ "sh", "-c", cmd }, {
on_stdout = function(_, data)
for _, line in ipairs(data) do
if line ~= "" then