]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
scripts: dump stdin on meson-buildoptions error
authorNabih Estefan <nabihestefan@google.com>
Thu, 27 Feb 2025 18:04:54 +0000 (18:04 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 6 Mar 2025 11:44:46 +0000 (12:44 +0100)
Dump sys.stdin when it errors on meson-buildoptions.py, letting us debug
the build errors instead of just saying "Couldn't parse"

Signed-off-by: Nabih Estefan <nabihestefan@google.com>
Signed-off-by: Patrick Venture <venture@google.com>
Link: https://lore.kernel.org/r/20250227180454.2006757-1-venture@google.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
scripts/meson-buildoptions.py

index 4814a8ff61f946bd9d1d5453b0be3320d600c624..a3e22471b2fdc2d89bf99fe5f755b65213ff7b28 100644 (file)
@@ -241,8 +241,14 @@ def print_parse(options):
     print("  esac")
     print("}")
 
-
-options = load_options(json.load(sys.stdin))
+json_data = sys.stdin.read()
+try:
+    options = load_options(json.loads(json_data))
+except:
+    print("Failure in scripts/meson-buildoptions.py parsing stdin as json",
+          file=sys.stderr)
+    print(json_data, file=sys.stderr)
+    sys.exit(1)
 print("# This file is generated by meson-buildoptions.py, do not edit!")
 print_help(options)
 print_parse(options)