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 <dwheeler@dwheeler.com>
This commit is contained in:
David A. Wheeler 2021-06-29 18:51:44 -04:00 committed by GitHub
parent 18b559b69d
commit b7e8ebe3df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -1,7 +1,11 @@
#!/bin/sh -l #!/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 # $2 output filename
flawfinder $1 > "$2" output="${2:-flawfinder-output.txt}"
echo "Executed with success." flawfinder $1 > "$output"
result="$?"
cat "$output"
exit "$result"