From 3b6b304f55122c7ac323b5dc60e454c0cfcd954d Mon Sep 17 00:00:00 2001 From: maxjivi05 Date: Mon, 26 Oct 2026 07:42:55 -0400 Subject: [PATCH] fix: take the Agent's empty answer for an uninstalled game as gone Once Blizzard's Agent has removed a game it answers GET /game/ with an empty object, not installed false, so a finished uninstall read as a failure and opened Battle.net. --- tools/linuxfs/overlay/usr/local/bin/droiddeck-battlenet | 5 +++-- tools/tests/test_battlenet.py | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/linuxfs/overlay/usr/local/bin/droiddeck-battlenet b/tools/linuxfs/overlay/usr/local/bin/droiddeck-battlenet index 5b3444be0..35518880a 100755 --- a/tools/linuxfs/overlay/usr/local/bin/droiddeck-battlenet +++ b/tools/linuxfs/overlay/usr/local/bin/droiddeck-battlenet @@ -1227,7 +1227,8 @@ def agent_job(root, action, uid, product="", folder="", locale="enUS", country=" leftovers = wine_processes(pfx) if leftovers and idle(leftovers): stop(leftovers) - game = read_status(base + ".game") or {} + answer = read_status(base + ".game") + game = answer or {} status = read_status(base + ".json") or {} try: with open(base + ".error", "rb") as f: @@ -1248,7 +1249,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 False: + if reason is None and action == "uninstall" and (game.get("installed") is False or answer == {}): emit("DONE", json.dumps({"uninstalled": uid})) say("%s uninstalled" % uid) return 0 diff --git a/tools/tests/test_battlenet.py b/tools/tests/test_battlenet.py index d0c01b9a0..93680ef5c 100644 --- a/tools/tests/test_battlenet.py +++ b/tools/tests/test_battlenet.py @@ -1210,6 +1210,9 @@ class AgentJobTest(Harness): 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") + self.files = {".game": json.dumps({})} + self.assertEqual(BNET["agent_job"](self.root, "uninstall", "gryphon", poll=0), 0) + self.assertEqual(self.lines[-1], ("DONE", json.dumps({"uninstalled": "gryphon"}))) 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)