From b7e8ebe3df08a8777d4f3d0e675580b1fc949d15 Mon Sep 17 00:00:00 2001 From: "David A. Wheeler" Date: Tue, 29 Jun 2021 18:51:44 -0400 Subject: [PATCH] entrypoint.sh: Make minor improvements (#54) * entrypoint.sh: Make minor improvements Modify entrypoint.sh, used by the Dockerfile. The original version *ALWAYS* echoed a success, even if the command did NOT succeed for some reason. Instead of printing the spurious message, just show the output and let the exit value get communicated back to the caller. This is especially important for CI/CD, since we want the CI/CD system to get the exit value (e.g., so it can report failure if there was a failure). This version also displays the results to standard out, so it's easier to immediately see the output from a CI/CD run. Signed-off-by: David A. Wheeler --- entrypoint.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index b89e0ad..f887f2e 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,7 +1,11 @@ #!/bin/sh -l -# $1 arguments. BEWARE: Some filenames may need to be escaped. +# $1 whitespace-separated arguments. Some filenames may need to be escaped. # $2 output filename -flawfinder $1 > "$2" +output="${2:-flawfinder-output.txt}" -echo "Executed with success." +flawfinder $1 > "$output" +result="$?" + +cat "$output" +exit "$result"