def start(self, direction, path=''):
self.ensureKeyPerms()
unisonPath = self.getUnisonBin()
unisonArgs = self.getUnisonArgs(direction, path)
unisonEnv = self.getUnisonEnv()
if self.ignoreArchives:
# It seems that in certain cases, unison does not observe the -ignorearchives flag correctly
# So to make sure, we forcibly delete previous archives on both sides
res = Try.sequence([
# Delete host archives
Shell.call(["rm", "-rf", unisonEnv['UNISON']], shell=False),
# Delete guest archives
self.engine.readLink().bind(Link.runCommand, 'rm -rf /substance/.unison')
])
if res.isFail():
return res
logger.info("Syncing local directory %s to remote directory %s", unisonArgs[-2], unisonArgs[-1])
logger.debug("EXEC: %s", Shell.stringify([unisonPath] + unisonArgs, unisonEnv))
os.execve(unisonPath, unisonArgs, unisonEnv)
评论列表
文章目录