mirror of
https://github.com/appleboy/ssh-action.git
synced 2025-04-20 03:33:29 +00:00
capturing stdout
This commit is contained in:
parent
c14811a802
commit
4188bdc3ce
@ -68,24 +68,10 @@ chmod +x ${TARGET}
|
|||||||
echo "======= CLI Version ======="
|
echo "======= CLI Version ======="
|
||||||
sh -c "${TARGET} --version" # print version
|
sh -c "${TARGET} --version" # print version
|
||||||
echo "==========================="
|
echo "==========================="
|
||||||
echo "STDOUT: $INPUT_CAPTURE_STDOUT"
|
|
||||||
if [[ "$INPUT_CAPTURE_STDOUT" == 'true' ]]; then
|
if [[ "$INPUT_CAPTURE_STDOUT" == 'true' ]]; then
|
||||||
_stdout=/dev/stdout
|
echo 'stdout<<EOF' >> $GITHUB_OUTPUT # use a heredoc for multiline output
|
||||||
if [[ "$INPUT_CAPTURE_STDOUT" == 'true' ]]; then
|
sh -c "${TARGET} $*" >> $GITHUB_OUTPUT # run the command
|
||||||
_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
|
echo 'EOF' >> $GITHUB_OUTPUT
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
sh -c "${TARGET} $*" # run the command
|
sh -c "${TARGET} $*" # run the command
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user