commit | dde2137657998af111f051d619657fbb233fc882 | [log] [tgz] |
---|---|---|
author | Eli Lipsitz <elipsitz@google.com> | Fri Jan 27 15:57:48 2023 +0000 |
committer | CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> | Fri Jan 27 15:57:48 2023 +0000 |
tree | 039b5264aea27e7ba20a66201b4ee01d6559d677 | |
parent | f15937dffb591ce091aa79a0e39f669b1088b454 [diff] |
pw_build: Ensure TERM is set by pw-wrap-ninja when invoking Ninja pw-wrap-ninja relies on scraping terminal output from Ninja. Specifically, it relies on the feature of Ninja where it outputs a status line both when edge starts running and when an edge finishes running. Ninja only has this behavior when it detects that it's running in a "smart terminal", the logic for which is: stdout must be connected to a tty *and* the TERM environment variable is set *and* the TERM environment variable is not 'dumb'. pw-wrap-ninja always runs Ninja with a pty to satisfy the first part of the condition, but if it's running without TERM set, Ninja will think it's in a dumb terminal, and only outputs the "edge finished" line, which confuses the script (it makes it look like the edge started and finished running immediately). This commit rectifies this behavior by ensuring that it sets TERM to vt100 if no TERM is set. We don't *always* set it, because we would want to suppress subcommands' colors if we're not actually running in a real smart terminal (e.g. in a CI job). Tested: Manually unset TERM. Invoked pw-wrap-ninja, ensured that it was able to properly detect edge start/finish, and any output had the terminal codes expected. Change-Id: I8a4399b39b3da3f00f50c85273d4e72e4132a379 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/126920 Reviewed-by: Rob Mohr <mohrr@google.com> Commit-Queue: Eli Lipsitz <elipsitz@google.com>
Pigweed is an open source collection of embedded-targeted libraries–or as we like to call them, modules. These modules are building blocks and infrastructure that enable faster and more reliable development on small-footprint MMU-less 32-bit microcontrollers like the STMicroelectronics STM32L452 or the Nordic nRF52832.
For more information please see our website: https://pigweed.dev/.