From: Aleš Mrázek Date: Mon, 26 Jan 2026 12:50:49 +0000 (+0100) Subject: python: controller/interface.py: return full message if JSON load fails for Subproces... X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e4b5b64cd9c786620c3e12d8204fc28dad39501e;p=thirdparty%2Fknot-resolver.git python: controller/interface.py: return full message if JSON load fails for Subprocess command result --- diff --git a/python/knot_resolver/controller/interface.py b/python/knot_resolver/controller/interface.py index 28add7493..c1360f0ff 100644 --- a/python/knot_resolver/controller/interface.py +++ b/python/knot_resolver/controller/interface.py @@ -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: