Skip to content

Commit 7baa986

Browse files
committed
capture exit code of callback and return at the end
because should set -e be disabled when withCustomOutputInput is called (which can happen for various reasons: on the left side of || in an if, function which uses withCustomOutputInput happens to be in an if etc. we would no longer exit.
1 parent 1a87e46 commit 7baa986

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/utility/io.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,12 @@ function withCustomOutputInput() {
7676
# same same if $withCustomOutputInput_fun should fail/exit, we don't setup a trap, the system should clean it up
7777
rm "$withCustomOutputInput_tmpFile" || true
7878

79-
$withCustomOutputInput_fun "$@"
79+
local exitCode=0
80+
$withCustomOutputInput_fun "$@" || exitCode=$?
8081

8182
eval "exec ${withCustomOutputInput_outputNr}>&-"
8283
eval "exec ${withCustomOutputInput_inputNr}<&-"
84+
return "$exitCode"
8385
}
8486

8587
function deleteDirChmod777() {

0 commit comments

Comments
 (0)