summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs/simple
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2017-06-18 12:30:08 +0200
committertv <tv@krebsco.de>2017-06-18 12:30:08 +0200
commit9f2b087650fc27d80e91e9f44d1af3a94155b95e (patch)
treeeb84874757544e627454b7785a10b10ce01ee255 /krebs/5pkgs/simple
parent2ac38bb79d4444a713ad77ac17b53cc5dc4913f6 (diff)
whatsupnix: exit 2 if there were build errors
Diffstat (limited to 'krebs/5pkgs/simple')
-rw-r--r--krebs/5pkgs/simple/whatsupnix/whatsupnix.bash19
1 files changed, 15 insertions, 4 deletions
diff --git a/krebs/5pkgs/simple/whatsupnix/whatsupnix.bash b/krebs/5pkgs/simple/whatsupnix/whatsupnix.bash
index 7089e8897..1d93f3e5c 100644
--- a/krebs/5pkgs/simple/whatsupnix/whatsupnix.bash
+++ b/krebs/5pkgs/simple/whatsupnix/whatsupnix.bash
@@ -1,14 +1,21 @@
#!/usr/bin/env bash
-
+#
# Prints build logs for failed derivations in quiet build mode (-Q).
# See https://github.com/NixOS/nix/issues/443
#
# Usage:
#
-# set -o pipefail
# nix-build ... -Q ... | whatsupnix [user@target[:port]]
#
-
+# Exit Codes:
+#
+# 0 No failed derivations could be found. This either means there where
+# no build errors, or stdin wasn't nix-build output.
+#
+# 1 Usage error; arguments couldn't be parsed.
+#
+# 2 Build error; at least one failed derivation could be found.
+#
GAWK=${GAWK:-gawk}
NIX_STORE=${NIX_STORE:-nix-store}
@@ -69,4 +76,8 @@ while read -r drv; do
echo
done < "$broken"
-exit 0
+if test -s "$broken"; then
+ exit 2
+else
+ exit 0
+fi