diff options
Diffstat (limited to 'sb_builder/remote.py')
| -rw-r--r-- | sb_builder/remote.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sb_builder/remote.py b/sb_builder/remote.py index 5340f6c..f87ef66 100644 --- a/sb_builder/remote.py +++ b/sb_builder/remote.py @@ -55,9 +55,10 @@ class Remote(QObject): "-o", "ControlPersist=10m", "-o", "BatchMode=yes", "-o", "ConnectTimeout=5", *r["ssh_options"], r["target"], "sbb-remote", *map(shlex.quote, args)] - def call(self, cb, *args): - """Run sbb-remote <args>, then cb(data, error).""" - self._run("ssh", self.ssh_args(*args), lambda rc, out, err: cb(*parse(rc, out, err))) + def call(self, cb, *args, stdin=None): + """Run sbb-remote <args>, then cb(data, error). stdin: bytes for the helper.""" + self._run("ssh", self.ssh_args(*args), lambda rc, out, err: cb(*parse(rc, out, err)), + stdin) def virsh(self, cb, *args): """Run local virsh against the configured libvirt URI, then cb(rc, text).""" @@ -71,7 +72,7 @@ class Remote(QObject): p.start("ssh", self.ssh_args("job-follow", jid, str(offset))) return p - def _run(self, prog, argv, cb): + def _run(self, prog, argv, cb, stdin=None): p = QProcess(self) def done(rc, _status=None): @@ -82,3 +83,6 @@ class Remote(QObject): p.errorOccurred.connect( lambda e: e == QProcess.ProcessError.FailedToStart and done(-1)) p.start(prog, argv) + if stdin is not None: + p.write(stdin) + p.closeWriteChannel() |
