mirror of https://github.com/octoleo/lsyncd.git
removed call to nonexisting func, comments, when mv fails on direct, rm -rf origin
This commit is contained in:
parent
cdab37124d
commit
79e182cefe
21
lsyncd.lua
21
lsyncd.lua
|
@ -563,6 +563,9 @@ local InletFactory = (function()
|
||||||
return e2s[event].config
|
return e2s[event].config
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
-----
|
||||||
|
-- Returns the inlet belonging to an event.
|
||||||
|
--
|
||||||
inlet = function(event)
|
inlet = function(event)
|
||||||
return e2s[event].inlet
|
return e2s[event].inlet
|
||||||
end,
|
end,
|
||||||
|
@ -578,14 +581,17 @@ local InletFactory = (function()
|
||||||
end,
|
end,
|
||||||
|
|
||||||
-----
|
-----
|
||||||
-- Tells script this isnt a list.
|
-- Tells this isn't a list.
|
||||||
--
|
--
|
||||||
isList = function()
|
isList = function()
|
||||||
return false
|
return false
|
||||||
end,
|
end,
|
||||||
|
|
||||||
-----
|
-----
|
||||||
-- Status
|
-- Return the status of the event.
|
||||||
|
-- Can be:
|
||||||
|
-- 'wait', 'active', 'block'.
|
||||||
|
--
|
||||||
status = function(event)
|
status = function(event)
|
||||||
return e2d[event].status
|
return e2d[event].status
|
||||||
end,
|
end,
|
||||||
|
@ -1330,7 +1336,6 @@ local Sync = (function()
|
||||||
if self.delays.size > 0 then
|
if self.delays.size > 0 then
|
||||||
stack(self.delays[self.delays.last], nd)
|
stack(self.delays[self.delays.last], nd)
|
||||||
end
|
end
|
||||||
addDelayPath("", nd)
|
|
||||||
nd.dpos = Queue.push(self.delays, nd)
|
nd.dpos = Queue.push(self.delays, nd)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -3447,9 +3452,15 @@ local default_direct = {
|
||||||
end
|
end
|
||||||
spawn(event, "/bin/rm", "-rf", tp)
|
spawn(event, "/bin/rm", "-rf", tp)
|
||||||
elseif event.etype == "Move" then
|
elseif event.etype == "Move" then
|
||||||
spawn(event, "/bin/mv", event.targetPath, event2.targetPath)
|
local tp = event.targetPath
|
||||||
|
-- extra security check
|
||||||
|
if tp == "" or tp == "/" or not tp then
|
||||||
|
error("Refusing to erase your harddisk")
|
||||||
|
end
|
||||||
|
spawnShell(event, "/bin/mv $1 $2 || /bin/rm -rf $1", event.targetPath, event2.targetPath)
|
||||||
else
|
else
|
||||||
error("Do not know how to handle unknown event")
|
log("Warn", "ignored an event of type '", event.etype, "'")
|
||||||
|
inlet.discardEvent(event)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue