mirror of
https://github.com/saphid/frame-control.git
synced 2026-10-06 04:04:21 +02:00
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:
1 parent
e4421d966a
commit
98a5ec45bb
2 files changed
+18
-2
No files matched your search
@@ -363,6 +363,22 @@ class Bundled(unittest.TestCase):
|
|||||||
self.server.ssh, self.server.LOCAL = old
|
self.server.ssh, self.server.LOCAL = old
|
||||||
self.assertEqual(calls, ["rm -rf .local/share/frame-control/kdeconnect/incoming/ab12"])
|
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):
|
def test_copies_go_to_a_folder_of_their_own(self):
|
||||||
first, _, _ = self.deliver(frame_has=False)
|
first, _, _ = self.deliver(frame_has=False)
|
||||||
second, _, _ = self.deliver(frame_has=False)
|
second, _, _ = self.deliver(frame_has=False)
|
||||||
|
|||||||
+2
-2
@@ -659,8 +659,8 @@ class InputAgent:
|
|||||||
if folder.startswith(f"{KDECONNECT_HOME}/incoming/") and not LOCAL:
|
if folder.startswith(f"{KDECONNECT_HOME}/incoming/") and not LOCAL:
|
||||||
try:
|
try:
|
||||||
ssh(f"rm -rf {folder}", timeout=20)
|
ssh(f"rm -rf {folder}", timeout=20)
|
||||||
except Failure:
|
except (Failure, OSError):
|
||||||
pass
|
pass # never let tidying up get in the way of reporting and retrying
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
with self.lock:
|
with self.lock:
|
||||||
|
|||||||
Reference in new issue
Block a user