Skip to content

Commit dcb47b8

Browse files
committed
scripts: prevent awk from buffering the output
1 parent 1dcf4d7 commit dcb47b8

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

scripts/lib/utils.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,16 @@ portable_realpath() {
5959
realpath "$@" ;;
6060
esac
6161
}
62+
63+
portable_stdbuf() {
64+
case "$OSTYPE" in
65+
darwin*)
66+
if [ -z "$(which gstdbuf)" ]; then
67+
echo "gstdbuf needed under OSX, please \`brew install coreutils\`"
68+
exit 1
69+
fi
70+
gstdbuf "$@" ;;
71+
*)
72+
stdbuf "$@" ;;
73+
esac
74+
}

scripts/run-browser-tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ false && source _config.sh # never executes, this is here just for IntelliJ Bash
66
pushd "$ROOT"
77

88
echo "Running browser tests..."
9-
lein with-profile +test-runner trampoline run -m "$@" 2>&1 | awk -f "$SCRIPTS/browser-tests-output-filter.awk"
9+
lein with-profile +test-runner trampoline run -m "$@" 2>&1 | portable_stdbuf -o0 awk -f "$SCRIPTS/browser-tests-output-filter.awk"
1010

1111
popd

0 commit comments

Comments
 (0)