Skip to content

Commit ed3da9d

Browse files
committed
let stacktrace exit code pass through
1 parent cac2b1f commit ed3da9d

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

examples/stacktrace/src/lib/stacktrace.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
## default in bashly generated scripts.
1515
##
1616
stacktrace() {
17+
local exit_status="$?"
1718
local i=0
1819
local caller_output line func file
1920

@@ -24,5 +25,5 @@ stacktrace() {
2425
printf "\tfrom %s:%s in \`%s\`\n" "$file" "$line" "$func"
2526
i=$((i + 1))
2627
done
27-
exit 1
28+
exit "$exit_status"
2829
} >&2

lib/bashly/libraries/stacktrace/stacktrace.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
## default in bashly generated scripts.
1515
##
1616
stacktrace() {
17+
local exit_status="$?"
1718
local i=0
1819
local caller_output line func file
1920

@@ -24,5 +25,5 @@ stacktrace() {
2425
printf "\tfrom %s:%s in \`%s\`\n" "$file" "$line" "$func"
2526
i=$((i + 1))
2627
done
27-
exit 1
28+
exit "$exit_status"
2829
} >&2

spec/approvals/examples/stacktrace

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@ Examples:
5151

5252
Stack trace:
5353
from ./download:15 in `root_command`
54-
from ./download:254 in `run`
55-
from ./download:260 in `main`
54+
from ./download:255 in `run`
55+
from ./download:261 in `main`

0 commit comments

Comments
 (0)