mirror of
https://github.com/sstephenson/bats.git
synced 2024-11-17 11:42:33 +01:00
bats: Don't pipe to cat for nonpretty output
Under Bash 3.2.57(1)-release and 4.4.12(1)-release on a MacBook Pro with a 2.9GHz Intel Core i5 CPU and 8GB 1867MHz DDR3 RAM, this shaves off O(0.04-0.05s) from the current test suite. Very minor, but it's a straightforward change that may provide a minor-yet-noticeable effect on Windows. Before this change: 46 tests, 0 failures real 0m3.588s user 0m2.171s sys 0m1.046s After this change: real 0m3.538s user 0m2.119s sys 0m0.941s
This commit is contained in:
parent
d4443adeb7
commit
7bcbb2f3e9
12
libexec/bats
12
libexec/bats
|
@ -154,13 +154,11 @@ else
|
||||||
command="bats-exec-suite"
|
command="bats-exec-suite"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$pretty" ]; then
|
set -o pipefail execfail
|
||||||
|
if [ -z "$pretty" ]; then
|
||||||
|
exec "$command" $count_flag "${filenames[@]}"
|
||||||
|
else
|
||||||
extended_syntax_flag="-x"
|
extended_syntax_flag="-x"
|
||||||
formatter="bats-format-tap-stream"
|
formatter="bats-format-tap-stream"
|
||||||
else
|
exec "$command" $count_flag $extended_syntax_flag "${filenames[@]}" | "$formatter"
|
||||||
extended_syntax_flag=""
|
|
||||||
formatter="cat"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
set -o pipefail execfail
|
|
||||||
exec "$command" $count_flag $extended_syntax_flag "${filenames[@]}" | "$formatter"
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user