mirror of
https://github.com/saphid/frame-control.git
synced 2026-10-06 05:02:50 +02:00
Align continuation lines after the run_ssh rename
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
34a334fa27
commit
865e8dc17f
6 files changed
+14
-14
No files matched your search
+1
-1
@@ -48,7 +48,7 @@ def ssh(cmd, input=None, timeout=120):
|
|||||||
# No inherited stdin (see server.ssh): Windows' ssh.exe would wait on it.
|
# 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}
|
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,
|
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:
|
except subprocess.TimeoutExpired:
|
||||||
raise FrameError(f'timed out talking to {FRAME}')
|
raise FrameError(f'timed out talking to {FRAME}')
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ REMOTE = Path(android.ROOT) / 'frame/android/app-data.py'
|
|||||||
def _stream(command, src=None, dst=None):
|
def _stream(command, src=None, dst=None):
|
||||||
try:
|
try:
|
||||||
result = frame_host.run_ssh(['ssh', *android.SSH_OPTS, android.FRAME, command],
|
result = frame_host.run_ssh(['ssh', *android.SSH_OPTS, android.FRAME, command],
|
||||||
stdin=src if src else subprocess.DEVNULL,
|
stdin=src if src else subprocess.DEVNULL,
|
||||||
stdout=dst if dst else subprocess.PIPE,
|
stdout=dst if dst else subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE, timeout=1800)
|
stderr=subprocess.PIPE, timeout=1800)
|
||||||
except subprocess.TimeoutExpired:
|
except subprocess.TimeoutExpired:
|
||||||
raise android.FrameError('app-data transfer timed out')
|
raise android.FrameError('app-data transfer timed out')
|
||||||
except OSError as error:
|
except OSError as error:
|
||||||
|
|||||||
+2
-2
@@ -352,8 +352,8 @@ def _write_config(host, port, user):
|
|||||||
def key_login_works():
|
def key_login_works():
|
||||||
# accept-new: trust a first-seen host key (as the copy step does); a changed one still fails.
|
# 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",
|
return frame_host.run_ssh(["ssh", "-o", "BatchMode=yes", "-o", "ConnectTimeout=5",
|
||||||
"-o", "StrictHostKeyChecking=accept-new", FRAME_ALIAS, "true"],
|
"-o", "StrictHostKeyChecking=accept-new", FRAME_ALIAS, "true"],
|
||||||
capture_output=True).returncode == 0
|
capture_output=True).returncode == 0
|
||||||
|
|
||||||
|
|
||||||
def configured_user():
|
def configured_user():
|
||||||
|
|||||||
+2
-2
@@ -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."""
|
"""The port ssh uses for ALIAS with this config file (`ssh -F FILE -G ALIAS`), else 22."""
|
||||||
try:
|
try:
|
||||||
out = frame_host.run_ssh(["ssh", "-F", str(config), "-G", alias], capture_output=True, text=True,
|
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):
|
except (OSError, subprocess.TimeoutExpired):
|
||||||
return 22
|
return 22
|
||||||
m = re.search(r"^port (\d+)$", out, re.M)
|
m = re.search(r"^port (\d+)$", out, re.M)
|
||||||
@@ -347,7 +347,7 @@ def effective_port(alias, config):
|
|||||||
def _keygen(*args):
|
def _keygen(*args):
|
||||||
try:
|
try:
|
||||||
return frame_host.run_ssh(["ssh-keygen", *args], capture_output=True, stdin=subprocess.DEVNULL, text=True,
|
return frame_host.run_ssh(["ssh-keygen", *args], capture_output=True, stdin=subprocess.DEVNULL, text=True,
|
||||||
timeout=10)
|
timeout=10)
|
||||||
except (OSError, subprocess.TimeoutExpired):
|
except (OSError, subprocess.TimeoutExpired):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -75,7 +75,7 @@ def ssh_g(alias):
|
|||||||
ssh alias. proxied: it goes through ProxyJump or ProxyCommand, so only ssh can reach it."""
|
ssh alias. proxied: it goes through ProxyJump or ProxyCommand, so only ssh can reach it."""
|
||||||
try:
|
try:
|
||||||
out = frame_host.run_ssh(["ssh", "-G", alias], capture_output=True, stdin=subprocess.DEVNULL, text=True,
|
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):
|
except (OSError, subprocess.TimeoutExpired):
|
||||||
out = ""
|
out = ""
|
||||||
got = {}
|
got = {}
|
||||||
@@ -766,7 +766,7 @@ class Link:
|
|||||||
return False
|
return False
|
||||||
try:
|
try:
|
||||||
return frame_host.run_ssh([*self.mux_base, *opts, "-O", "check", alias or self.alias], capture_output=True,
|
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):
|
except (OSError, subprocess.TimeoutExpired):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@@ -778,7 +778,7 @@ class Link:
|
|||||||
if self.control and self.alias:
|
if self.control and self.alias:
|
||||||
try:
|
try:
|
||||||
frame_host.run_ssh([*self.mux_base, *self.opts, "-O", "exit", self.alias], capture_output=True,
|
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):
|
except (OSError, subprocess.TimeoutExpired):
|
||||||
pass
|
pass
|
||||||
if proc and proc.poll() is None:
|
if proc and proc.poll() is None:
|
||||||
@@ -984,7 +984,7 @@ class Link:
|
|||||||
"-o", "StrictHostKeyChecking=yes", device["alias"], "true"]
|
"-o", "StrictHostKeyChecking=yes", device["alias"], "true"]
|
||||||
try:
|
try:
|
||||||
r = frame_host.run_ssh(argv, capture_output=True, stdin=subprocess.DEVNULL, text=True,
|
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()
|
err = r.stderr.strip()
|
||||||
if r.returncode == 0:
|
if r.returncode == 0:
|
||||||
rows[i].update(ssh="ok", detail=f"{lead} · SSH works")
|
rows[i].update(ssh="ok", detail=f"{lead} · SSH works")
|
||||||
|
|||||||
+2
-2
@@ -333,7 +333,7 @@ def ssh(remote, *, stdin=None, timeout=30, text=True):
|
|||||||
# --exit-on-eof, and Windows' ssh.exe waits on it forever.
|
# --exit-on-eof, and Windows' ssh.exe waits on it forever.
|
||||||
feed = {"input": stdin} if stdin is not None else {"stdin": subprocess.DEVNULL}
|
feed = {"input": stdin} if stdin is not None else {"stdin": subprocess.DEVNULL}
|
||||||
r = frame_host.run_ssh([*SSH, FRAME, remote], capture_output=True, **feed,
|
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:
|
except subprocess.TimeoutExpired:
|
||||||
raise Failure(f"Timed out talking to {FRAME}")
|
raise Failure(f"Timed out talking to {FRAME}")
|
||||||
if r.returncode != 0:
|
if r.returncode != 0:
|
||||||
@@ -504,7 +504,7 @@ def save_shots(body):
|
|||||||
try:
|
try:
|
||||||
try:
|
try:
|
||||||
r = frame_host.run_ssh(["scp", "-p", *SSH[1:], *(f"{FRAME}:{p}" for p in todo), str(incoming)],
|
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:
|
except subprocess.TimeoutExpired:
|
||||||
raise Failure("Copying screenshots timed out")
|
raise Failure("Copying screenshots timed out")
|
||||||
if r.returncode != 0:
|
if r.returncode != 0:
|
||||||
|
|||||||
Reference in new issue
Block a user