fix(users/Profpatsch/lib/eprintenv): don’t crash when env is missing
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>
This commit is contained in:
parent
d6bca70840
commit
18e6db0f21
1 changed files with 4 additions and 1 deletions
|
@ -22,7 +22,10 @@ let
|
||||||
];
|
];
|
||||||
|
|
||||||
eprintenv = depot.nix.writeExecline "eprintenv" { readNArgs = 1; } [
|
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
|
# remove everything but a few selected environment variables
|
||||||
|
|
Loading…
Reference in a new issue