fix: wait for a cancelled Battle.net job before removing it, and bound uninstall waits

A cancelled install now waits for its Agent job to end before the
uninstall runs, and removes the folder only once the Agent no longer
lists the game or the folder is empty. Uninstall gives up when Battle.net
or a game keeps the prefix busy for a minute, so the page falls back to
opening Battle.net. An uninstall only counts when the Agent reports the
game as not installed.
This commit is contained in:
maxjivi05 authored and MaxsTechReview committed 2026-10-26 09:01:02 -04:00
1 parent b887e8653d
commit c48297e0d1
4 files changed
+51 -17

No files matched your search

@@ -1248,7 +1248,7 @@ def agent_job(root, action, uid, product="", folder="", locale="enUS", country="
"version": game.get("local_version", "")}, sort_keys=True))
say("%s %s in %s" % (uid, "updated" if action == "update" else "installed", game.get("install_dir", windows)))
return 0
if reason is None and action == "uninstall" and game.get("installed") is not True:
if reason is None and action == "uninstall" and game.get("installed") is False:
emit("DONE", json.dumps({"uninstalled": uid}))
say("%s uninstalled" % uid)
return 0
+6
View File
@@ -1205,6 +1205,12 @@ class AgentJobTest(Harness):
self.assertEqual(BNET["agent_job"](self.root, "uninstall", "gryphon", poll=0), 0)
self.assertEqual(self.lines[:2], [("STATE", "queued"), ("STATE", "starting")])
def test_an_uninstall_needs_the_agent_to_say_the_game_is_gone(self):
self.install()
self.files = {".game": json.dumps({"error": 2})}
self.assertEqual(BNET["agent_job"](self.root, "uninstall", "gryphon", poll=0), 1)
self.assertEqual(self.lines[-1][0], "ERROR")
def test_without_battle_net_nothing_starts(self):
self.assertEqual(BNET["agent_job"](self.root, "install", "gryphon", "gryphon", str(self.tmp / "g"), "enUS", "USA", "US", poll=0), 3)
self.assertEqual(self.lines, [("ERROR", "client")])