fix(build): tolerate control chars in pio project config JSON dump

get_platform_for_env() in build.sh parses `pio project config
--json-output` with Python's strict json.load(), which rejects literal
control characters inside string values. Depending on the installed
pio version, a build_flags value can embed one there, breaking
env-name lookup with "Invalid control character" before the actual
build even starts. strict=False accepts it, same as a lenient JSON
consumer would for a non-conforming producer.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-06-20 01:50:28 +02:00
parent 4999620fba
commit e7e910782c

View File

@@ -96,7 +96,7 @@ get_platform_for_env() {
local env_name=$1 local env_name=$1
echo "$PIO_CONFIG_JSON" | python3 -c " echo "$PIO_CONFIG_JSON" | python3 -c "
import sys, json, re import sys, json, re
data = json.load(sys.stdin) data = json.load(sys.stdin, strict=False)
for section, options in data: for section, options in data:
if section == 'env:$env_name': if section == 'env:$env_name':
for key, value in options: for key, value in options: