Skip to content

Commit

Permalink
[build] Conditionally use time -f, since it's not POSIX shell
Browse files Browse the repository at this point in the history
This is issue #2227.
  • Loading branch information
Andy C committed Jan 21, 2025
1 parent 4986f63 commit 42f197e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions build/ninja-rules-cpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,10 @@ compile_one() {
# Show timing info on the most expensive translation unit
case $in in
*/oils_for_unix.*)
# Must have external 'time', so we test with 'which', not 'command -v'.
# busybox time supports -f but not --format.
if which time >/dev/null; then
# Must have external 'time', and it must have -f
# Notes: OS X has no time -f
# busybox time supports -f but not --format.
if command time -f '%e %M' true >/dev/null; then
set -- \
time -f "$out { elapsed: %e, max_RSS: %M }" -- \
"$@"
Expand Down

0 comments on commit 42f197e

Please sign in to comment.