Skip to content

Commit

Permalink
fix: nil check on_exit and on_stderr config functions (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
OscarCreator authored Feb 15, 2024
1 parent 3b5288e commit 1b8930f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lua/rsync/sync.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ local function safe_sync(command, on_start, on_exit)
log.info(string.format("safe_sync command: '%s', on_stderr: '%s'", command, vim.inspect(output)))
end

config.get_current_config().on_stderr(output, command)
if config.get_current_config().on_stderr ~= nil then
config.get_current_config().on_stderr(output, command)
end
end,

-- job done executing
Expand All @@ -43,7 +45,9 @@ local function safe_sync(command, on_start, on_exit)
log.info(string.format("safe_sync command: '%s', on_exit with code = '%s'", command, code))
end

config.get_current_config().on_exit(code, command)
if config.get_current_config().on_exit ~= nil then
config.get_current_config().on_exit(code, command)
end
end,
stdout_buffered = true,
stderr_buffered = true,
Expand Down

0 comments on commit 1b8930f

Please sign in to comment.