Skip to content

Commit d6fa304

Browse files
authored
fix: only append when scratch.buffer is not nil (#317)
1 parent 4912b0a commit d6fa304

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

lua/cmake-tools/utils.lua

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,11 @@ function utils.run(cmd, env_script, env, args, cwd, runner, callback)
205205

206206
ntfy:notify(cmd, "info")
207207

208-
local _mes =
209-
{ "[RUN]:", cmd, table.concat(args, " "), "<ENV>", table.concat(env, " "), "{CWD}", cwd }
210-
scratch.append(table.concat(_mes, " "))
208+
if scratch.buffer ~= nil then
209+
local _mes =
210+
{ "[RUN]:", cmd, table.concat(args, " "), "<ENV>", table.concat(env, " "), "{CWD}", cwd }
211+
scratch.append(table.concat(_mes, " "))
212+
end
211213

212214
utils.get_runner(runner.name).run(cmd, env_script, env, args, cwd, runner.opts, function(code)
213215
local msg = "Exited with code " .. code
@@ -244,9 +246,11 @@ function utils.execute(cmd, env_script, env, args, cwd, executor, callback)
244246
local ntfy = notification:new("executor")
245247
ntfy:notify(cmd, "info")
246248

247-
local _mes =
248-
{ "[EXECUTE]:", cmd, table.concat(args, " "), "<ENV>", table.concat(env, " "), "{CWD}", cwd }
249-
scratch.append(table.concat(_mes, " "))
249+
if scratch.buffer ~= nil then
250+
local _mes =
251+
{ "[EXECUTE]:", cmd, table.concat(args, " "), "<ENV>", table.concat(env, " "), "{CWD}", cwd }
252+
scratch.append(table.concat(_mes, " "))
253+
end
250254

251255
utils
252256
.get_executor(executor.name)

0 commit comments

Comments
 (0)