Commit 17787c8e authored by juadde's avatar juadde
Browse files

Dynamic allocation for file descriptors used in ./build-host.sh

Visual studio code had an issue with file descriptors already used by the integrated terminal.
This commit asks bash to dynamically assign a "free" file descriptor to be used in the expect function.
Closes #135
parent 9163ac89
......@@ -67,8 +67,8 @@ function start_qemu() {
-serial pipe:guest \
-nographic || kill "${$}"; } &
# We want to send the output to both stdout (fd1) and fd10 (used by the expect function)
exec 3>&1 10< <(tee /dev/fd/3 <guest.out)
# We want to send the output to both stdout (fd1) and a new file descriptor (used by the expect function)
exec 3>&1 {fd}< <(tee /dev/fd/3 <guest.out)
}
# Wait for a specific string from qemu
......@@ -80,7 +80,7 @@ function expect() {
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 "${timeout}" c
IFS= read -r -u ${fd} -n 1 -t "${timeout}" 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