aboutsummaryrefslogtreecommitdiffstats
path: root/lua/conform/runner.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/conform/runner.lua')
-rw-r--r--lua/conform/runner.lua10
1 files changed, 9 insertions, 1 deletions
diff --git a/lua/conform/runner.lua b/lua/conform/runner.lua
index 4146163..4b166a9 100644
--- a/lua/conform/runner.lua
+++ b/lua/conform/runner.lua
@@ -299,7 +299,7 @@ local function run_formatter(bufnr, formatter, config, ctx, input_lines, opts, c
local stderr
local exit_codes = config.exit_codes or { 0 }
local jid
- jid = vim.fn.jobstart(cmd, {
+ local ok, jid_or_err = pcall(vim.fn.jobstart, cmd, {
cwd = cwd,
env = env,
stdout_buffered = true,
@@ -364,6 +364,14 @@ local function run_formatter(bufnr, formatter, config, ctx, input_lines, opts, c
end
end,
})
+ if not ok then
+ callback({
+ code = errors.ERROR_CODE.JOBSTART,
+ message = string.format("Formatter '%s' error in jobstart: %s", formatter.name, jid_or_err),
+ })
+ return
+ end
+ jid = jid_or_err
if jid == 0 then
callback({
code = errors.ERROR_CODE.INVALID_ARGS,