lib.ec.ssh: Don't quote shell operators

Naively join()ing a command list to be executed remotely via SSH also
quotes shell operators which doesn't work, of course. Work around
that. The workaround will not always work but covers lots of cases.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-04-10 14:58:29 +02:00
commit 84375cd482
4 changed files with 50 additions and 7 deletions

View file

@ -2,10 +2,9 @@ from __future__ import annotations
from typing import TYPE_CHECKING
import shlex
from ...util import run_cmd
from ..SSHClient import SSHClient as Base
from .util import join_cmd
if TYPE_CHECKING:
from ...ExecContext import Result
@ -41,5 +40,5 @@ class Exec(Base):
async def _run_ssh(self, cmd: list[str], cmd_input: str|None, *args, **kwargs) -> Result:
self.__init_askpass()
return await run_cmd(['ssh', self.hostname, shlex.join(cmd)], cmd_input=cmd_input)
return await run_cmd(['ssh', self.hostname, join_cmd(cmd)], cmd_input=cmd_input)