From 1eb716c232d999ba31e9d16d2abff7ebd295811a Mon Sep 17 00:00:00 2001 From: Matthias Kruk Date: Tue, 15 Feb 2022 10:33:36 +0900 Subject: [PATCH] include/log: Don't mangle whitespaces Because IFS is not set in `_log_write()`, logging functions silently drop whitespace from the beginning and end of each line. This commit modifies `_log_write()` to set IFS to the empty string when invoking `read`, so that whitespaces are not stripped. --- include/log.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/log.sh b/include/log.sh index d5e866b..b9eb3cc 100644 --- a/include/log.sh +++ b/include/log.sh @@ -106,7 +106,7 @@ _log_write() { echo "$timestamp $$ $prefix $line" 1>&2 done else - while read -r line; do + while IFS="" read -r line; do _log_write "$level" "$prefix" "$line" done fi -- 2.47.3