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