So the `cc1` calls can also be seen in context. `/dev/tty` is used instead of writing to standard output because standard output is expectd to be redirected and may in some cases even be consulted by code in a build script, whereas we really do want to write to the terminal. This also: - Has the `wrap1` script use `-e` so that it will stop at the first error. No command before the last one should fail. If the `flock` command fails, either due to a lock-related error or due to an error in `tee`, we want to know about it. I should've done this before, but it's more important now that I'm also tee-ing to `/dev/tty`: it's not obvious that this would work on CI. - Tweaks the code style of the `printf` command, to make the command slightly more readable, and make clearer that this is really just being used as a portable alternative to `echo`.
Unified · Split
| @@ -67,10 +67,10 @@ jobs: · 66 unmodified lines | ||
| 67 | 67 | - name: Wrap cc1 (and cc1plus if present) to record calls |
| 68 | 68 | run: | |
| 69 | 69 | cat >/usr/local/bin/wrapper1 <<'EOF' |
| 70 | − #!/bin/sh | |
| 71 | − printf '%s %s\n' "$0" "$*" | | |
| 70 | + #!/bin/sh -e | |
| 71 | + printf '%s\n' "$0 $*" | | |
| 72 | 72 | flock /run/lock/wrapper1.fbd136bd-9b1b-448d-84a9-e18be53ae63c.lock \ |
| 73 | − tee -a /var/log/wrapper1.log >/dev/null # TODO: Also log to terminal device? | |
| 73 | + tee -a /var/log/wrapper1.log /dev/tty >/dev/null | |
| 74 | 74 | exec "$0.orig" "$@" |
| 75 | 75 | EOF |
| 76 | 76 | |