From: Matthias Kruk Date: Tue, 15 Feb 2022 01:33:36 +0000 (+0900) Subject: include/log: Don't mangle whitespaces X-Git-Url: https://git.corax.cc/?a=commitdiff_plain;h=1eb716c232d999ba31e9d16d2abff7ebd295811a;p=toolbox 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. --- 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