Skip to content

Commit

Permalink
Merge pull request #49 from cederberg/patch-1
Browse files Browse the repository at this point in the history
Fixed command output echoing to preserve spaces
  • Loading branch information
chrismytton committed Sep 15, 2021
2 parents f39ef22 + f90c42c commit 91fca54
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion shoreman.sh
Expand Up @@ -37,7 +37,7 @@ log() {
format="\033[0;${color}m%s %s\t|\033[0m %s"
fi

while read -r data
while IFS= read -r data
do
printf "$format\n" "$(date +"%H:%M:%S")" "$1" "$data"
done
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/whitespace_output_procfile
@@ -0,0 +1 @@
test: echo " output whitespace is preserved "
6 changes: 6 additions & 0 deletions test/shoreman_test.sh
Expand Up @@ -68,3 +68,9 @@ it_can_force_colors_on() {
output=$(SHOREMAN_COLORS=always ./shoreman.sh 'test/fixtures/simple_procfile'; :)
echo "$output" | grep -q $(printf "\033")
}

it_preserves_output_whitespace() {
output=$(./shoreman.sh 'test/fixtures/whitespace_output_procfile'; :)
expected=' output whitespace is preserved '
echo "$output" | grep -q -F "| ${expected}"
}

0 comments on commit 91fca54

Please sign in to comment.