From fbfbd39fefa89d90460a154989f3751f3cbd4770 Mon Sep 17 00:00:00 2001 From: Ondra Pelech Date: Sun, 17 Nov 2024 12:32:04 +0100 Subject: [PATCH] Handle case of .mill-version with Windows line ends (#65) This is a precaution for cases when the `.mill-version` file can contain a Windows line end `\r\n` instead of the typical Unix line end `\n`. Without this fix, in such situation the script breaks in a spectacular and surprising way. Pull request: https://github.com/lefou/millw/pull/65 --- millw | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/millw b/millw index 1c162d2..a169517 100755 --- a/millw +++ b/millw @@ -49,9 +49,9 @@ fi # If not already set, read .mill-version file if [ -z "${MILL_VERSION}" ] ; then if [ -f ".mill-version" ] ; then - MILL_VERSION="$(head -n 1 .mill-version 2> /dev/null)" + MILL_VERSION="$(tr '\r' '\n' < .mill-version | head -n 1 2> /dev/null)" elif [ -f ".config/mill-version" ] ; then - MILL_VERSION="$(head -n 1 .config/mill-version 2> /dev/null)" + MILL_VERSION="$(tr '\r' '\n' < .config/mill-version | head -n 1 2> /dev/null)" fi fi