]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
python: controller/interface.py: return full message if JSON load fails for Subproces... docs-subprocess-c-nisp39/deployments/8447
authorAleš Mrázek <ales.mrazek@nic.cz>
Mon, 26 Jan 2026 12:50:49 +0000 (13:50 +0100)
committerAleš Mrázek <ales.mrazek@nic.cz>
Mon, 26 Jan 2026 12:50:49 +0000 (13:50 +0100)
python/knot_resolver/controller/interface.py

index 28add74935f1f7cb067b76a9806e838c06c6e42e..c1360f0ffa7ef04e1641eec382e5565b6dc12386 100644 (file)
@@ -224,7 +224,11 @@ class Subprocess(ABC):
             # read result
             (msg_len,) = struct.unpack(">I", await reader.read(4))
             result_bytes = await reader.readexactly(msg_len)
-            return json.loads(result_bytes.decode("utf8"))
+
+            try:
+                return json.loads(result_bytes.decode("utf8"))
+            except json.JSONDecodeError:
+                return result_bytes.decode("utf8")
 
         finally:
             if writer is not None: