From bc48a9c92fd341eb2fbdef699c9cd06cb2438ae0 Mon Sep 17 00:00:00 2001 From: Kondal Kolipaka Date: Wed, 3 Apr 2019 13:48:10 +0530 Subject: [PATCH] Stdoutflush: Flushing stdout to avoid issues with 64k char limits --- tools/kconfig_new/confserver.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/kconfig_new/confserver.py b/tools/kconfig_new/confserver.py index a5e5b4868..1156321ec 100755 --- a/tools/kconfig_new/confserver.py +++ b/tools/kconfig_new/confserver.py @@ -78,9 +78,11 @@ def run_server(kconfig, sdkconfig, default_version=MAX_PROTOCOL_VERSION): # V1: no 'visibility' key, send value None for any invisible item values_dict = dict((k, v if visible_dict[k] else False) for (k,v) in config_dict.items()) json.dump({"version": 1, "values": values_dict, "ranges": ranges_dict}, sys.stdout) + sys.stdout.flush() else: # V2 onwards: separate visibility from version json.dump({"version": default_version, "values": config_dict, "ranges": ranges_dict, "visible": visible_dict}, sys.stdout) + sys.stdout.flush() print("\n") while True: @@ -92,6 +94,7 @@ def run_server(kconfig, sdkconfig, default_version=MAX_PROTOCOL_VERSION): except ValueError as e: # json module throws JSONDecodeError (sublcass of ValueError) on Py3 but ValueError on Py2 response = {"version": default_version, "error": ["JSON formatting error: %s" % e]} json.dump(response, sys.stdout) + sys.stdout.flush() print("\n") continue before = confgen.get_json_values(config) @@ -141,6 +144,7 @@ def run_server(kconfig, sdkconfig, default_version=MAX_PROTOCOL_VERSION): print("Error: %s" % e, file=sys.stderr) response["error"] = error json.dump(response, sys.stdout) + sys.stdout.flush() print("\n")