diff --git a/src/python/jw/pkg/lib/ec/ssh/Exec.py b/src/python/jw/pkg/lib/ec/ssh/Exec.py index c566f9e2..c53362e4 100644 --- a/src/python/jw/pkg/lib/ec/ssh/Exec.py +++ b/src/python/jw/pkg/lib/ec/ssh/Exec.py @@ -41,6 +41,4 @@ class Exec(Base): async def _run_ssh(self, cmd: list[str], cmd_input: bytes|None, *args, **kwargs) -> Result: self.__init_askpass() - if cmd_input is None: - cmd_input = InputMode.Interactive if self.interactive else InputMode.NonInteractive - return await run_cmd(['ssh', self.hostname, join_cmd(cmd)], cmd_input=cmd_input, interactive=self.interactive, throw=False) + return await run_cmd(['ssh', self.hostname, join_cmd(cmd)], cmd_input=cmd_input, throw=False) diff --git a/src/python/jw/pkg/lib/util.py b/src/python/jw/pkg/lib/util.py index a0d3bef6..7798988b 100644 --- a/src/python/jw/pkg/lib/util.py +++ b/src/python/jw/pkg/lib/util.py @@ -33,11 +33,12 @@ def pretty_cmd(cmd: list[str], wd=None): return ret # See ExecContext.run() for what this function does -async def run_cmd(*args, ec: ExecContext|None=None, verbose: bool|None=None, interactive: bool=False, **kwargs) -> Result: +async def run_cmd(*args, ec: ExecContext|None=None, verbose: bool|None=None, cmd_input: Input=InputMode.NonInteractive, **kwargs) -> Result: if verbose is None: verbose = False if ec is None else ec.verbose_default if ec is None: from .ec.Local import Local + interactive = cmd_input == InputMode.Interactive ec = Local(verbose_default=verbose, interactive=interactive) return await ec.run(verbose=verbose, *args, **kwargs)