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:
clan-bot
2024-10-28 11:26:27 +00:00

View File

@@ -327,6 +327,7 @@ class Host:
cwd: None | str | Path = None,
check: bool = True,
timeout: float = math.inf,
needs_user_terminal: bool = False,
) -> subprocess.CompletedProcess[str]:
if extra_env is None:
extra_env = {}
@@ -367,8 +368,9 @@ class Host:
stderr=stderr_write,
env=env,
cwd=cwd,
start_new_session=True,
start_new_session=not needs_user_terminal,
) as p:
if not needs_user_terminal:
stack.enter_context(terminate_process_group(p))
if write_std_fd is not None:
write_std_fd.close()
@@ -517,6 +519,8 @@ class Host:
cwd=cwd,
check=check,
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]: