Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Fix exit code for check_line_terminators.sh #7970

Merged
merged 1 commit into from
Jul 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/7970.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add a script to detect source code files using non-unix line terminators.
5 changes: 4 additions & 1 deletion scripts-dev/check_line_terminators.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

decided to make it red while I was here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The red text didn't work for me when I ran this as ./scripts-dev/check_line_terminators.sh

(Directly running this line did work though...)

Not sure if it is mac / zsh messing something up though.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

odd. It works here, and I'm pretty confident it will work on buildkite (we have other scripts which do the same). How sad does it make you that it doesn't work for you?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sad enough to block merging this. 👍

exit 1
fi