diff --git a/shoreman.sh b/shoreman.sh index 877f75e..b14af2f 100755 --- a/shoreman.sh +++ b/shoreman.sh @@ -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 diff --git a/test/fixtures/whitespace_output_procfile b/test/fixtures/whitespace_output_procfile new file mode 100644 index 0000000..c681975 --- /dev/null +++ b/test/fixtures/whitespace_output_procfile @@ -0,0 +1 @@ +test: echo " output whitespace is preserved " diff --git a/test/shoreman_test.sh b/test/shoreman_test.sh index 4f048d8..e8cfa0f 100644 --- a/test/shoreman_test.sh +++ b/test/shoreman_test.sh @@ -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}" +}