genJqSecretsReplacementSnippet: Fix error handling
With the previous change that enabled error propagation through `inherit_errexit`, the script would fail if `errexit` was set, but `inherit_errexit` was not. This is due to `shopt -p` exiting with an error if the option is disabled. To work around this, use the exit code instead of the text value returned by `shopt -p`. Fixes #160869.
This commit is contained in:
parent
96cd003963
commit
b549e7bbb5
|
@ -150,7 +150,8 @@ rec {
|
||||||
rm '${output}'
|
rm '${output}'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
inherit_errexit_restore=$(shopt -p inherit_errexit)
|
inherit_errexit_enabled=0
|
||||||
|
shopt -pq inherit_errexit && inherit_errexit_enabled=1
|
||||||
shopt -s inherit_errexit
|
shopt -s inherit_errexit
|
||||||
''
|
''
|
||||||
+ concatStringsSep
|
+ concatStringsSep
|
||||||
|
@ -170,7 +171,7 @@ rec {
|
||||||
' <<'EOF'
|
' <<'EOF'
|
||||||
${builtins.toJSON set}
|
${builtins.toJSON set}
|
||||||
EOF
|
EOF
|
||||||
$inherit_errexit_restore
|
(( ! $inherit_errexit_enabled )) && shopt -u inherit_errexit
|
||||||
'';
|
'';
|
||||||
|
|
||||||
systemdUtils = {
|
systemdUtils = {
|
||||||
|
|
Loading…
Reference in a new issue