stdenv: fix showBuildStats

- remove going through another file
- use builtin instead of external cat
- improve echo formatting
This commit is contained in:
happysalada 2021-09-06 12:05:15 +09:00 committed by Raphael Megzari
parent 2f6c17537d
commit 02c142a2dd

View file

@ -121,14 +121,12 @@ exitHandler() {
set +e set +e
if [ -n "${showBuildStats:-}" ]; then if [ -n "${showBuildStats:-}" ]; then
times > "$NIX_BUILD_TOP/.times" read -r -d '' -a buildTimes < <(times)
local -a times=($(cat "$NIX_BUILD_TOP/.times")) echo "build times:"
# Print the following statistics: echo "user time for the shell ${buildTimes[0]}"
# - user time for the shell echo "system time for the shell ${buildTimes[1]}"
# - system time for the shell echo "user time for all child processes ${buildTimes[2]}"
# - user time for all child processes echo "system time for all child processes ${buildTimes[3]}"
# - system time for all child processes
echo "build time elapsed: " "${times[@]}"
fi fi
if (( "$exitCode" != 0 )); then if (( "$exitCode" != 0 )); then