From f245cca8ad42c9d344b53a18c3fc1a3c6724c2d4 Mon Sep 17 00:00:00 2001 From: Steven Arcangeli <506791+stevearc@users.noreply.github.com> Date: Tue, 26 Dec 2023 06:38:00 -0800 Subject: fix(injected): handle inline injections (#251) --- tests/fake_formatter.sh | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'tests/fake_formatter.sh') diff --git a/tests/fake_formatter.sh b/tests/fake_formatter.sh index a060a4c..75f92ff 100755 --- a/tests/fake_formatter.sh +++ b/tests/fake_formatter.sh @@ -2,16 +2,24 @@ set -e -if [ -e "tests/fake_formatter_output" ]; then - cat tests/fake_formatter_output -else - cat +CODE=0 +if [ "$1" = "--fail" ]; then + shift + echo "failure" >&2 + CODE=1 +fi +if [ "$1" = "--timeout" ]; then + shift + echo "timeout" >&2 + sleep 4 fi -if [ "$1" = "--fail" ]; then - echo "failure" >&2 - exit 1 -elif [ "$1" = "--timeout" ]; then - sleep 4 +output_file="$1" + +if [ -n "$output_file" ] && [ -e "$output_file" ]; then + cat "$output_file" +else + cat fi +exit $CODE -- cgit v1.2.3-70-g09d2