Merge pull request 'ssh: fix ssh connections failing due to missing stdin' (#2291) from DavHau/clan-core:DavHau-dave into main
This commit is contained in:
@@ -327,6 +327,7 @@ class Host:
|
|||||||
cwd: None | str | Path = None,
|
cwd: None | str | Path = None,
|
||||||
check: bool = True,
|
check: bool = True,
|
||||||
timeout: float = math.inf,
|
timeout: float = math.inf,
|
||||||
|
needs_user_terminal: bool = False,
|
||||||
) -> subprocess.CompletedProcess[str]:
|
) -> subprocess.CompletedProcess[str]:
|
||||||
if extra_env is None:
|
if extra_env is None:
|
||||||
extra_env = {}
|
extra_env = {}
|
||||||
@@ -367,8 +368,9 @@ class Host:
|
|||||||
stderr=stderr_write,
|
stderr=stderr_write,
|
||||||
env=env,
|
env=env,
|
||||||
cwd=cwd,
|
cwd=cwd,
|
||||||
start_new_session=True,
|
start_new_session=not needs_user_terminal,
|
||||||
) as p:
|
) as p:
|
||||||
|
if not needs_user_terminal:
|
||||||
stack.enter_context(terminate_process_group(p))
|
stack.enter_context(terminate_process_group(p))
|
||||||
if write_std_fd is not None:
|
if write_std_fd is not None:
|
||||||
write_std_fd.close()
|
write_std_fd.close()
|
||||||
@@ -517,6 +519,8 @@ class Host:
|
|||||||
cwd=cwd,
|
cwd=cwd,
|
||||||
check=check,
|
check=check,
|
||||||
timeout=timeout,
|
timeout=timeout,
|
||||||
|
# all ssh commands can potentially ask for a password
|
||||||
|
needs_user_terminal=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
def nix_ssh_env(self, env: dict[str, str] | None) -> dict[str, str]:
|
def nix_ssh_env(self, env: dict[str, str] | None) -> dict[str, str]:
|
||||||
|
|||||||
Reference in New Issue
Block a user