Commit 194be3ff authored by Kristian Klausen's avatar Kristian Klausen 🎉
Browse files

Fail on EOF or read timeout

Running QEMU without hardware virtualization is very slow, so the
timeout is set very high.

Especially running qemu-img is very slow (the compression isn't
helping):
qemu-img convert -c -f raw -O qcow2 cloud-img.img Arch-Linux-x86_64-cloudimg-2020-08-31.qcow2
parent ca289d4c
......@@ -72,7 +72,10 @@ function expect() {
length="${#1}"
i=0
# We can't use ex: grep as we could end blocking forever, if the string isn't followed by a newline
while IFS= read -r -u 10 -n 1 c; do
while true; do
# read should never exit with a non-zero exit code,
# but it can happen if the fd is EOF or it times out
IFS= read -r -u 10 -n 1 -t 240 c
if [ "${1:${i}:1}" = "${c}" ]; then
i="$((i + 1))"
if [ "${length}" -eq "${i}" ]; then
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment