summary refs log tree commit diff
path: root/scripts-dev
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2020-07-28 13:52:25 +0100
committerGitHub <noreply@github.com>2020-07-28 08:52:25 -0400
commit8078dec3be29f849f730fdd91a83fd2b1f89726e (patch)
tree8ee324a83c1f15c6f56105e4ee930baacbdd2e95 /scripts-dev
parentOption to allow server admins to join complex rooms (#7902) (diff)
downloadsynapse-8078dec3be29f849f730fdd91a83fd2b1f89726e.tar.xz
Fix exit code for `check_line_terminators.sh` (#7970)
If there are *no* files with CRLF line endings, then the xargs exits with a
non-zero exit code (as expected), but then, since that is the last thing to
happen in the script, the script as a whole exits non-zero, making the whole
thing fail.

using `if/then/fi` instead of `&& (...)` means that the script exits with a
zero exit code.
Diffstat (limited to 'scripts-dev')
-rwxr-xr-xscripts-dev/check_line_terminators.sh5
1 files changed, 4 insertions, 1 deletions
diff --git a/scripts-dev/check_line_terminators.sh b/scripts-dev/check_line_terminators.sh
index 0f430e8397..c983956231 100755
--- a/scripts-dev/check_line_terminators.sh
+++ b/scripts-dev/check_line_terminators.sh
@@ -28,4 +28,7 @@
 cd `dirname $0`/..
 
 # Find and print files with non-unix line terminators
-find . -path './.git/*' -prune -o -type f -print0 | xargs -0 grep -I -l $'\r$' && ( echo 'found files with CRLF line endings'; exit 1 )
+if find . -path './.git/*' -prune -o -type f -print0 | xargs -0 grep -I -l $'\r$'; then
+    echo -e '\e[31mERROR: found files with CRLF line endings. See above.\e[39m'
+    exit 1
+fi