Skip to content

Commit

Permalink
capturing stdout
Browse files Browse the repository at this point in the history
  • Loading branch information
GammaGames committed Nov 25, 2024
1 parent c14811a commit 4188bdc
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,24 +68,10 @@ chmod +x ${TARGET}
echo "======= CLI Version ======="
sh -c "${TARGET} --version" # print version
echo "==========================="
echo "STDOUT: $INPUT_CAPTURE_STDOUT"
if [[ "$INPUT_CAPTURE_STDOUT" == 'true' ]]; then
_stdout=/dev/stdout
if [[ "$INPUT_CAPTURE_STDOUT" == 'true' ]]; then
_stdout=/tmp/_stdout
fi

{
sh -c "${TARGET} $*" # run the command
} | tee $_stdout

if [[ "$INPUT_CAPTURE_STDOUT" == 'true' ]]; then
echo "CAPTURING STDOUT $_stdout"
cat $_stdout
echo 'stdout<<EOF' >> $GITHUB_OUTPUT
cat $_stdout >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
fi
echo 'stdout<<EOF' >> $GITHUB_OUTPUT # use a heredoc for multiline output
sh -c "${TARGET} $*" >> $GITHUB_OUTPUT # run the command
echo 'EOF' >> $GITHUB_OUTPUT
else
sh -c "${TARGET} $*" # run the command
fi

0 comments on commit 4188bdc

Please sign in to comment.