From 010386211fa4942ba7b4a40a8d0b3bf7939d96b8 Mon Sep 17 00:00:00 2001 From: iliana etaoin Date: Mon, 10 Jun 2024 15:50:58 +0000 Subject: [PATCH 1/2] only unset xtrace if env.sh set it first --- env.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/env.sh b/env.sh index 74f3d1caf4..c946188fa7 100644 --- a/env.sh +++ b/env.sh @@ -4,11 +4,16 @@ # # See also: ./.envrc +OLD_SHELL_OPTS=$- set -o xtrace -OMICRON_WS="$(readlink -f $(dirname "${BASH_SOURCE[0]}"))" +OMICRON_WS=$(readlink -f "$(dirname "${BASH_SOURCE[0]}")") export PATH="$OMICRON_WS/out/cockroachdb/bin:$PATH" export PATH="$OMICRON_WS/out/clickhouse:$PATH" export PATH="$OMICRON_WS/out/dendrite-stub/bin:$PATH" export PATH="$OMICRON_WS/out/mgd/root/opt/oxide/mgd/bin:$PATH" -unset OMICRON_WS -set +o xtrace +# if xtrace was set previously, do not unset it +case $OLD_SHELL_OPTS in + *x*) ;; + *) set +o xtrace ;; +esac +unset OLD_SHELL_OPTS OMICRON_WS From a093b0088561cda8c66468cf433a86183962e615 Mon Sep 17 00:00:00 2001 From: iliana etaoin Date: Mon, 10 Jun 2024 15:58:35 +0000 Subject: [PATCH 2/2] ensure `set +o xtrace` is the last thing we do --- env.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/env.sh b/env.sh index c946188fa7..6a84c35902 100644 --- a/env.sh +++ b/env.sh @@ -6,14 +6,20 @@ OLD_SHELL_OPTS=$- set -o xtrace + OMICRON_WS=$(readlink -f "$(dirname "${BASH_SOURCE[0]}")") export PATH="$OMICRON_WS/out/cockroachdb/bin:$PATH" export PATH="$OMICRON_WS/out/clickhouse:$PATH" export PATH="$OMICRON_WS/out/dendrite-stub/bin:$PATH" export PATH="$OMICRON_WS/out/mgd/root/opt/oxide/mgd/bin:$PATH" + # if xtrace was set previously, do not unset it case $OLD_SHELL_OPTS in - *x*) ;; - *) set +o xtrace ;; + *x*) + unset OLD_SHELL_OPTS OMICRON_WS + ;; + *) + unset OLD_SHELL_OPTS OMICRON_WS + set +o xtrace + ;; esac -unset OLD_SHELL_OPTS OMICRON_WS