mirror of
https://github.com/appleboy/ssh-action.git
synced 2025-06-20 16:42:10 +10:00
remove stderr, stdout works
This commit is contained in:
parent
4819506395
commit
bd67bfa881
5 changed files with 54 additions and 83 deletions
|
@ -68,27 +68,20 @@ chmod +x ${TARGET}
|
|||
echo "======= CLI Version ======="
|
||||
sh -c "${TARGET} --version" # print version
|
||||
echo "==========================="
|
||||
if [ "$INPUT_CAPTURE_STDOUT" == 'true' ] || [ "$INPUT_CAPTURE_STDERR" == 'true' ]; then
|
||||
if [[ "$INPUT_CAPTURE_STDOUT" == 'true' ]]; then
|
||||
_stdout=/dev/stdout
|
||||
_stderr=/dev/stderr
|
||||
if [ "$INPUT_CAPTURE_STDOUT" == 'true' ]; then
|
||||
_stdout=/tmp/outFile
|
||||
fi
|
||||
if [ "$INPUT_CAPTURE_STDERR" == 'true' ]; then
|
||||
_stderr=/tmp/errFile
|
||||
if [[ "$INPUT_CAPTURE_STDOUT" == 'true' ]]; then
|
||||
_stdout=/tmp/_stdout
|
||||
fi
|
||||
|
||||
{
|
||||
sh -c "${TARGET} $*" # run the command
|
||||
} 2> $_stderr | tee $_stdout
|
||||
} | tee $_stdout
|
||||
|
||||
if [ "$INPUT_CAPTURE_STDOUT" == 'true' ]; then
|
||||
stdout=$(cat $_stdout)
|
||||
echo "stdout=${stdout//$'\n'/\\n}" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
if [ "$INPUT_CAPTURE_STDERR" == 'true' ]; then
|
||||
stderr=$(cat $_stderr)
|
||||
echo "stderr=${stderr//$'\n'/\\n}" >> $GITHUB_OUTPUT
|
||||
if [[ "$INPUT_CAPTURE_STDOUT" == 'true' ]]; then
|
||||
echo 'stdout<<EOF' >> $GITHUB_OUTPUT
|
||||
cat $_stdout >> $GITHUB_OUTPUT
|
||||
echo 'EOF' >> $GITHUB_OUTPUT
|
||||
fi
|
||||
else
|
||||
sh -c "${TARGET} $*" # run the command
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue