diff options
author | EuAndreh <eu@euandre.org> | 2023-03-29 08:38:04 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2023-03-29 09:03:33 -0300 |
commit | 3dd1abf43bfaed2f6792d38b61c38bc630bdda83 (patch) | |
tree | 609fa832e3026c9a2973aa6bdf6dabd8d4a095e8 /tests | |
parent | tests/vm-check.sh: Timestamp each output via ts(1) (diff) | |
download | package-repository-3dd1abf43bfaed2f6792d38b61c38bc630bdda83.tar.gz package-repository-3dd1abf43bfaed2f6792d38b61c38bc630bdda83.tar.xz |
tests/vm-check.sh: Add POSIX alternative to "sed -u"
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/vm-check.sh | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/vm-check.sh b/tests/vm-check.sh index e6b4af4..695e4d7 100755 --- a/tests/vm-check.sh +++ b/tests/vm-check.sh @@ -76,12 +76,23 @@ eval "$(assert-arg -- "${REMOTE:-}" '-r REMOTE')" SEP="$(color -c blacki ':')" + +pre() { + # Same as: + # sed -u "s|^|[$CMD]: |" + # but the "-u" option is not POSIX + IFS='' + while read -r line; do + printf '%s%s\n' "$1" "$line" + done +} + pre_guest() { - sed -u "s|^|$(color -c green "$HOST")$SEP$(color -c yellow "$TYPE")$SEP |" + pre "$(color -c green "$HOST")$SEP$(color -c yellow "$TYPE")$SEP " } pre_host() { - sed -u "s|^|$(color -c blueb "$0")$SEP |" + pre "$(color -c blueb "$0")$SEP " } STATUS_F="$(mkstemp)" |