irongit

Configure synchronization of files and directories through a plugin.

removed -m flag

huncholanehuncholaneauthored
parent 9288908commit e66be397a672ab75d04b0f6e124462409b4e4f1fBrowse files

1 file changed, +13 -9

+13-9lua/syncmap/rsync.lua
@@ -11,8 +11,15 @@ function M.run(args)
1111 local result = vim.fn.system(cmd)
1212 if vim.v.shell_error ~= 0 then
1313 log.error(table.concat(cmd, " ") .. " failed:\n" .. result)
14+ log.error(
15+ string.format(
16+ "Failed to run the the following rsync command.\n%s\nResult: %s",
17+ table.concat(cmd, " "),
18+ result
19+ )
20+ )
1421 else
15- log.info(table.concat(cmd, " ") .. " succeeded")
22+ log.info("Successfully ran the following rsync command.\n" .. table.concat(cmd, " "))
1623 end
1724 return result
1825 end
@@ -28,27 +35,24 @@ function M.spawn_watcher(args)
2835 })
2936 end
3037
31- local tag = string.format("syncmap:%s->%s", args.src, args.dst)
32-
3338 local cmd = string.format(
34- "while inotifywait -r -m -e modify,create,delete %q; do rsync %s %q %q; done; : %s",
39+ "while inotifywait -r -e modify,create,delete %q; do rsync %s %q %q; done",
3540 args.src,
3641 table.concat(args.flags, " "),
3742 args.src,
38- args.dst,
39- tag
43+ args.dst
4044 )
41- local cmd_str = "sh -c '" .. cmd .. "'"
45+ local cmd_str_for_log = "sh -c '" .. cmd .. "'"
4246
4347 local _, pid = simple_cmd.spawn("sh", {
4448 args = { "-c", cmd },
4549 path = "sh",
4650 cwd = args.src,
4751 callback = function(code, status, _, pid)
48- log.info(string.format("%s\n%d completed with %d code and %d status", cmd_str, pid, code, status))
52+ log.info(string.format("%s\n%d completed with %d code and %d status", cmd_str_for_log, pid, code, status))
4953 end,
5054 })
51- log.info(string.format("%s\nPid is %d", cmd_str, pid))
55+ log.info(string.format("Started the following command with pid %d\n%s", pid, cmd_str_for_log))
5256 return pid
5357 end
5458