aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2023-03-29 08:38:04 -0300
committerEuAndreh <eu@euandre.org>2023-03-29 09:03:33 -0300
commit3dd1abf43bfaed2f6792d38b61c38bc630bdda83 (patch)
tree609fa832e3026c9a2973aa6bdf6dabd8d4a095e8 /tests
parenttests/vm-check.sh: Timestamp each output via ts(1) (diff)
downloadpackage-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-xtests/vm-check.sh15
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)"