mirror of
https://github.com/appleboy/ssh-action.git
synced 2026-11-16 09:15:01 +08:00
fix(output): randomize captured output delimiter
A standalone EOF line is valid remote stdout, but the runner interprets it as the end of the captured multiline value. Generate one Bash-only randomized delimiter per capture and use it for both framing lines while preserving the streaming tee pipeline and its failure behavior.
This commit is contained in:
parent
b838bc2f27
commit
d3b63444cd
1 changed files with 3 additions and 2 deletions
|
|
@ -71,9 +71,10 @@ if ! "${TARGET}" --version; then
|
|||
fi
|
||||
echo "======================================="
|
||||
if [[ "${INPUT_CAPTURE_STDOUT}" == 'true' ]]; then
|
||||
echo 'stdout<<EOF' >> "${GITHUB_OUTPUT}"
|
||||
OUTPUT_DELIMITER="EOF_${RANDOM}_${RANDOM}_${RANDOM}_${RANDOM}_${RANDOM}_${RANDOM}_${RANDOM}_${RANDOM}"
|
||||
echo "stdout<<${OUTPUT_DELIMITER}" >> "${GITHUB_OUTPUT}"
|
||||
"${TARGET}" "$@" | tee -a "${GITHUB_OUTPUT}"
|
||||
echo 'EOF' >> "${GITHUB_OUTPUT}"
|
||||
echo "${OUTPUT_DELIMITER}" >> "${GITHUB_OUTPUT}"
|
||||
else
|
||||
"${TARGET}" "$@"
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue