Skip to content

Commit

Permalink
Wrap test for -x flag in an if and rename variables to something slig…
Browse files Browse the repository at this point in the history
…htly more intuitive.

Signed-off-by: J. Paul Reed <[email protected]>
  • Loading branch information
preed committed Jul 22, 2018
1 parent 68c10ae commit 47fc38c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ci-common-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@
# printed to the console when shell execution tracing (-x) is turned on.
# Most of the CI scripts will "set -x" if "$ENABLE_DEBUG_BUILD_ENV" is set.

__current_shell_flags=""
__original_shell_flags=""

function disable_execution_tracing() {
__current_shell_flags="$-"
__original_shell_flags="$-"
set +x
}

function reenable_execution_tracing() {
[[ "$__current_shell_flags" =~ "x" ]] && set -x
if [[ "$__original_shell_flags" =~ "x" ]]; then
set -x
fi
}

0 comments on commit 47fc38c

Please sign in to comment.