diff --git a/ui/frame_android.py b/ui/frame_android.py index ceaa02f..eff7c19 100644 --- a/ui/frame_android.py +++ b/ui/frame_android.py @@ -48,7 +48,7 @@ def ssh(cmd, input=None, timeout=120): # No inherited stdin (see server.ssh): Windows' ssh.exe would wait on it. feed = {'input': input} if input is not None else {'stdin': subprocess.DEVNULL} p = frame_host.run_ssh(['ssh', *SSH_OPTS, FRAME, cmd], capture_output=True, **feed, - timeout=timeout, text=isinstance(input, str) or input is None) + timeout=timeout, text=isinstance(input, str) or input is None) except subprocess.TimeoutExpired: raise FrameError(f'timed out talking to {FRAME}') if p.returncode != 0: diff --git a/ui/frame_android_data.py b/ui/frame_android_data.py index dc6e7a5..c1a5dfb 100644 --- a/ui/frame_android_data.py +++ b/ui/frame_android_data.py @@ -19,9 +19,9 @@ REMOTE = Path(android.ROOT) / 'frame/android/app-data.py' def _stream(command, src=None, dst=None): try: result = frame_host.run_ssh(['ssh', *android.SSH_OPTS, android.FRAME, command], - stdin=src if src else subprocess.DEVNULL, - stdout=dst if dst else subprocess.PIPE, - stderr=subprocess.PIPE, timeout=1800) + stdin=src if src else subprocess.DEVNULL, + stdout=dst if dst else subprocess.PIPE, + stderr=subprocess.PIPE, timeout=1800) except subprocess.TimeoutExpired: raise android.FrameError('app-data transfer timed out') except OSError as error: diff --git a/ui/frame_connect.py b/ui/frame_connect.py index c43a7cf..c0cefa4 100644 --- a/ui/frame_connect.py +++ b/ui/frame_connect.py @@ -352,8 +352,8 @@ def _write_config(host, port, user): def key_login_works(): # accept-new: trust a first-seen host key (as the copy step does); a changed one still fails. return frame_host.run_ssh(["ssh", "-o", "BatchMode=yes", "-o", "ConnectTimeout=5", - "-o", "StrictHostKeyChecking=accept-new", FRAME_ALIAS, "true"], - capture_output=True).returncode == 0 + "-o", "StrictHostKeyChecking=accept-new", FRAME_ALIAS, "true"], + capture_output=True).returncode == 0 def configured_user(): diff --git a/ui/frame_devices.py b/ui/frame_devices.py index e575a59..fb2f29a 100644 --- a/ui/frame_devices.py +++ b/ui/frame_devices.py @@ -334,7 +334,7 @@ def effective_port(alias, config): """The port ssh uses for ALIAS with this config file (`ssh -F FILE -G ALIAS`), else 22.""" try: out = frame_host.run_ssh(["ssh", "-F", str(config), "-G", alias], capture_output=True, text=True, - stdin=subprocess.DEVNULL, timeout=10).stdout + stdin=subprocess.DEVNULL, timeout=10).stdout except (OSError, subprocess.TimeoutExpired): return 22 m = re.search(r"^port (\d+)$", out, re.M) @@ -347,7 +347,7 @@ def effective_port(alias, config): def _keygen(*args): try: return frame_host.run_ssh(["ssh-keygen", *args], capture_output=True, stdin=subprocess.DEVNULL, text=True, - timeout=10) + timeout=10) except (OSError, subprocess.TimeoutExpired): return None diff --git a/ui/frame_link.py b/ui/frame_link.py index b2e8e39..d9fd551 100644 --- a/ui/frame_link.py +++ b/ui/frame_link.py @@ -75,7 +75,7 @@ def ssh_g(alias): ssh alias. proxied: it goes through ProxyJump or ProxyCommand, so only ssh can reach it.""" try: out = frame_host.run_ssh(["ssh", "-G", alias], capture_output=True, stdin=subprocess.DEVNULL, text=True, - timeout=10).stdout + timeout=10).stdout except (OSError, subprocess.TimeoutExpired): out = "" got = {} @@ -766,7 +766,7 @@ class Link: return False try: return frame_host.run_ssh([*self.mux_base, *opts, "-O", "check", alias or self.alias], capture_output=True, - stdin=subprocess.DEVNULL, timeout=5).returncode == 0 + stdin=subprocess.DEVNULL, timeout=5).returncode == 0 except (OSError, subprocess.TimeoutExpired): return False @@ -778,7 +778,7 @@ class Link: if self.control and self.alias: try: frame_host.run_ssh([*self.mux_base, *self.opts, "-O", "exit", self.alias], capture_output=True, - stdin=subprocess.DEVNULL, timeout=5) + stdin=subprocess.DEVNULL, timeout=5) except (OSError, subprocess.TimeoutExpired): pass if proc and proc.poll() is None: @@ -984,7 +984,7 @@ class Link: "-o", "StrictHostKeyChecking=yes", device["alias"], "true"] try: r = frame_host.run_ssh(argv, capture_output=True, stdin=subprocess.DEVNULL, text=True, - errors="replace", timeout=20) + errors="replace", timeout=20) err = r.stderr.strip() if r.returncode == 0: rows[i].update(ssh="ok", detail=f"{lead} ยท SSH works") diff --git a/ui/server.py b/ui/server.py index 14ec154..aab1325 100755 --- a/ui/server.py +++ b/ui/server.py @@ -333,7 +333,7 @@ def ssh(remote, *, stdin=None, timeout=30, text=True): # --exit-on-eof, and Windows' ssh.exe waits on it forever. feed = {"input": stdin} if stdin is not None else {"stdin": subprocess.DEVNULL} r = frame_host.run_ssh([*SSH, FRAME, remote], capture_output=True, **feed, - text=text, errors="replace" if text else None, timeout=timeout) + text=text, errors="replace" if text else None, timeout=timeout) except subprocess.TimeoutExpired: raise Failure(f"Timed out talking to {FRAME}") if r.returncode != 0: @@ -504,7 +504,7 @@ def save_shots(body): try: try: r = frame_host.run_ssh(["scp", "-p", *SSH[1:], *(f"{FRAME}:{p}" for p in todo), str(incoming)], - capture_output=True, stdin=subprocess.DEVNULL, text=True, timeout=300) + capture_output=True, stdin=subprocess.DEVNULL, text=True, timeout=300) except subprocess.TimeoutExpired: raise Failure("Copying screenshots timed out") if r.returncode != 0: