Skip to content

Commit

Permalink
Also log to terminal, interleaved with cargo output
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
EliahKagan committed Nov 17, 2024
1 parent 90a59f9 commit 2eb9f23
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ jobs:
- name: Wrap cc1 (and cc1plus if present) to record calls
run: |
cat >/usr/local/bin/wrapper1 <<'EOF'
#!/bin/sh
printf '%s %s\n' "$0" "$*" |
#!/bin/sh -e
printf '%s\n' "$0 $*" |
flock /run/lock/wrapper1.fbd136bd-9b1b-448d-84a9-e18be53ae63c.lock \
tee -a /var/log/wrapper1.log >/dev/null # TODO: Also log to terminal device?
tee -a /var/log/wrapper1.log /dev/tty >/dev/null
exec "$0.orig" "$@"
EOF
Expand Down

0 comments on commit 2eb9f23

Please sign in to comment.