Mercurial > hg > silvermirror
view silvermirror/unison.py @ 54:35b94053aafb default tip
update to use ssh for upstream src
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Sun, 02 Jun 2024 14:27:38 -0700 |
parents | 952a1c2e9cc1 |
children |
line wrap: on
line source
""" unison backend for silvermirror """ import pexpect import subprocess from .interface import Reflector class unison(Reflector): def sync(self, host, resource, ignore=(), password=None, test=False): command = ['unison', '-auto', '-batch', resource, 'ssh://%s/%s' % (host, resource)] for i in ignore: command.extend(('-ignore', "'Name %s'" % i)) command = ' '.join(command) print(command) if not test: if password: child = pexpect.spawn(command, timeout=36000, maxread=1) child.expect('password: ') child.sendline(password) print(child.read()) else: # XXX should not use shell=True subprocess.call(command, shell=True)