Bundled KDE Connect: tidying up can't leave the pad stuck starting

discard() swallows OSError as well as Failure, so a launch that fails and
can't remove its copy still reports the error and can be started again.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
saphidandClaude Opus 5.5 committed 2026-09-28 21:56:00 +10:00
1 parent e4421d966a
commit 98a5ec45bb
2 files changed
+18 -2

No files matched your search

+16
View File
@@ -363,6 +363,22 @@ class Bundled(unittest.TestCase):
self.server.ssh, self.server.LOCAL = old
self.assertEqual(calls, ["rm -rf .local/share/frame-control/kdeconnect/incoming/ab12"])
def test_a_launch_error_leaves_it_ready_to_try_again(self):
# Popen fails (say, out of file handles) and so does removing the copy: the
# page gets the error and the next start launches.
agent, launches, procs = self.lifecycle([])
agent.deliver = lambda report, force=False: "~/.local/share/frame-control/kdeconnect/incoming/z"
old_popen, old_ssh = self.server.subprocess.Popen, self.server.ssh
self.server.subprocess.Popen = self.server.ssh = lambda *a, **k: (_ for _ in ()).throw(OSError(24, "Too many open files"))
try:
agent.start()
self.wait_for(lambda: agent.status.get("state") == "error")
finally:
self.server.subprocess.Popen, self.server.ssh = old_popen, old_ssh
self.assertIsNone(agent.launching)
agent.start()
self.wait_for(lambda: agent.status == {"state": "ready"})
def test_copies_go_to_a_folder_of_their_own(self):
first, _, _ = self.deliver(frame_has=False)
second, _, _ = self.deliver(frame_has=False)
+2 -2
View File
@@ -659,8 +659,8 @@ class InputAgent:
if folder.startswith(f"{KDECONNECT_HOME}/incoming/") and not LOCAL:
try:
ssh(f"rm -rf {folder}", timeout=20)
except Failure:
pass
except (Failure, OSError):
pass # never let tidying up get in the way of reporting and retrying
def start(self):
with self.lock: