Set -x makes script finish with warning

(it@esnvseprague.cz) #1

Hi,
one of my deployment step is to run a Bash script. I’m using option of inline source code. The problem is, that if I call set -x that step will end with warning even when everything went ok.
POC:
set -x;
echo "foo";

(Justin Walsh) #3

Hi @it-at-esnvseprague.cz!

Thanks for reaching out - and for the great question! The reason you’re seeing a warning here is because with set -x set, it prints the expanded/executed commands to stderr, which Octopus detects as an error. As this is sent by the shell, and not the script, piping the single command stderr to stdout (2>&1) won’t help here either, sadly.

I hope this helps clarify this for you!