summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaio Oliveira <caio.oliveira@intel.com>2023-05-27 07:57:29 -0700
committerKenneth Graunke <kenneth@whitecape.org>2023-05-30 18:53:26 -0700
commitabb15b41ccd0b6491a84b8e1c8f4a75eccd71561 (patch)
tree05c027f8f4199a812a25f9b089563b5c5c6b7670
parenta9a7d9aad6d1d5d9adc9f5ff26191bd843f4d77e (diff)
Fix exit code for successful executions
The conditional in one line (A && B && C) would always fail in the case either A or B are not true, regardless our earlier build result. Since this was the last part of the script, the result would be used as exit code for nj. Change the one line into an actual if-statement, and also ensure we return early in case of the main build right above fails. This makes possible running "git rebase --exec nj".
-rwxr-xr-xnj7
1 files changed, 5 insertions, 2 deletions
diff --git a/nj b/nj
index 3fb0c30..92b2887 100755
--- a/nj
+++ b/nj
@@ -73,5 +73,8 @@ cd "$builddir"
extratargets="$(cat extratargets 2>/dev/null)"
targets="${@:-all $extratargets}"
-ninja $targets
-[[ "$targets" == all* ]] && [ -e install ] && ninja install > /dev/null
+ninja $targets || exit 1
+
+if [[ "$targets" == all* ]] && [ -e install ]; then
+ ninja install > /dev/null
+fi