diff options
author | talyz <kim.lindberger@gmail.com> | 2022-02-23 12:48:51 +0100 |
---|---|---|
committer | talyz <kim.lindberger@gmail.com> | 2022-02-23 12:48:51 +0100 |
commit | b549e7bbb5fa55cacf97b9aa405f73c030cf712b (patch) | |
tree | 5d9a3ccd9f35ae167d0660092457b9a6dca99fdf | |
parent | 96cd00396342173900ea0cff3eecbdadefff328b (diff) | |
download | nixpkgs-b549e7bbb5fa55cacf97b9aa405f73c030cf712b.tar nixpkgs-b549e7bbb5fa55cacf97b9aa405f73c030cf712b.tar.gz nixpkgs-b549e7bbb5fa55cacf97b9aa405f73c030cf712b.tar.bz2 nixpkgs-b549e7bbb5fa55cacf97b9aa405f73c030cf712b.tar.lz nixpkgs-b549e7bbb5fa55cacf97b9aa405f73c030cf712b.tar.xz nixpkgs-b549e7bbb5fa55cacf97b9aa405f73c030cf712b.tar.zst nixpkgs-b549e7bbb5fa55cacf97b9aa405f73c030cf712b.zip |
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.
-rw-r--r-- | nixos/lib/utils.nix | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/nixos/lib/utils.nix b/nixos/lib/utils.nix index 190c4db4d49..733f9ca522b 100644 --- a/nixos/lib/utils.nix +++ b/nixos/lib/utils.nix @@ -150,7 +150,8 @@ rec { rm '${output}' fi - inherit_errexit_restore=$(shopt -p inherit_errexit) + inherit_errexit_enabled=0 + shopt -pq inherit_errexit && inherit_errexit_enabled=1 shopt -s inherit_errexit '' + concatStringsSep @@ -170,7 +171,7 @@ rec { ' <<'EOF' ${builtins.toJSON set} EOF - $inherit_errexit_restore + (( ! $inherit_errexit_enabled )) && shopt -u inherit_errexit ''; systemdUtils = { |