diff options
author | Profpatsch <mail@profpatsch.de> | 2021-02-13T19·53+0100 |
---|---|---|
committer | Profpatsch <mail@profpatsch.de> | 2021-02-13T20·00+0000 |
commit | 18e6db0f2132cdc827687e2ada1d59aaf29ccb2a (patch) | |
tree | 8474e71ebbe77174726f1041873a817490fd1e11 /users/Profpatsch/lib.nix | |
parent | d6bca7084090b8519d0b881b6d78f2db19afc0d9 (diff) |
fix(users/Profpatsch/lib/eprintenv): don’t crash when env is missing r/2212
eprintenv is a debugging tool, as such the code should probably not crash when the environment variable we want to look at is missing. But we can print a warning instead. Change-Id: I41a24dc0c1cc488587563b85c1adbd089dd364f2 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2525 Tested-by: BuildkiteCI Reviewed-by: Profpatsch <mail@profpatsch.de>
Diffstat (limited to 'users/Profpatsch/lib.nix')
-rw-r--r-- | users/Profpatsch/lib.nix | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/users/Profpatsch/lib.nix b/users/Profpatsch/lib.nix index 9dd3cd481d7e..db81c2dfe321 100644 --- a/users/Profpatsch/lib.nix +++ b/users/Profpatsch/lib.nix @@ -22,7 +22,10 @@ let ]; eprintenv = depot.nix.writeExecline "eprintenv" { readNArgs = 1; } [ - "fdmove" "-c" "1" "2" bins.printenv "$1" "$@" + "ifelse" [ "fdmove" "-c" "1" "2" bins.printenv "$1" ] + [ "$@" ] + "if" [ eprintf "eprintenv: could not find \"\${1}\" in the environment\n" ] + "$@" ]; # remove everything but a few selected environment variables |