You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(build): lite-scons harness JSON protocol is corrupted by user-script print() #945
lite_scons_harness.py communicates its result to script_runtime.rs by writing JSON to stdout (json.dump(result, sys.stdout), line ~742). But user extra_scripts are exec'd in-process, so any direct print() in a user script lands on the same stdout ahead of the JSON. script_runtime.rs:146 then fails with:
build error: build failed: failed to parse extra_scripts runtime output: expected value at line 1 column 1
Found while standing up the #942 profiling harness: NightDriverStrip env:demo inherits extra_scripts = pre:tools/install_intelhex.py, pre:tools/pio_audit.py, pre:tools/bake_site.py, post:tools/merge_image.py, and both pio_audit.py and bake_site.py print progress banners (>>> NightDriver Coding Standard Audits, Baked index.html -> index.html.gz: 2693 B) straight to stdout. Reproduced by invoking the harness directly with those scripts — stdout begins with the banners, rc=0, JSON unparseable. Printing from PlatformIO extra_scripts is extremely common, so this breaks many real projects, not just NightDriverStrip.
Proposal
In lite_scons_harness.py, capture the real stdout handle at startup and exec user scripts (and Builder/Action callables) with sys.stdout/sys.stderr redirected to buffers. Surface captured text in the result payload (e.g. per-script stdout/stderr fields in lite_scons_records or notes) so output is preserved for verbose logs instead of discarded. Emit the final JSON to the saved real stdout only.
Acceptance criteria
A user extra_script that calls print() at import time and inside SCons callbacks no longer breaks overlay parsing.
Captured script output is present in the harness result payload (not silently dropped).
Rust-side test in script_runtime_tests.rs (or the lite_scons acceptance suite) covering a printing script.
Activity
fix(build): seal lite-scons harness JSON channel against user-script …