From 3232c2a1a1c05754246831d83f078445e472c2a1 Mon Sep 17 00:00:00 2001 From: Eberhard Beilharz Date: Wed, 9 Oct 2024 15:46:37 +0200 Subject: [PATCH] chore(common): allow to run `build.sh` scripts in `bashdb` debugger One of the traps prevents debugging a build script in the `bashdb` debugger. This change skips trapping `err` and `exit` when run under a debugger and so allows to debug the script with `bashdb`. --- resources/builder.inc.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/resources/builder.inc.sh b/resources/builder.inc.sh index c4cf586f42b..f72c36ca726 100755 --- a/resources/builder.inc.sh +++ b/resources/builder.inc.sh @@ -1488,7 +1488,10 @@ _builder_parse_expanded_parameters() { # Note: if an error occurs within a script's function in a `set -e` script, it becomes an exit # instead for the function's caller. So, we need both `err` and `exit` here. # See https://medium.com/@dirk.avery/the-bash-trap-trap-ce6083f36700. - trap _builder_failure_trap err exit + if [[ -z "$(trap -p DEBUG)" ]]; then + # not running in bashdb + trap _builder_failure_trap err exit + fi } _builder_pad() {