Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
juadde
arch-boxes
Commits
2f7eb691
Commit
2f7eb691
authored
Feb 16, 2021
by
juadde
Browse files
Use system-defined fd for expect function
parent
9163ac89
Pipeline
#5237
passed with stages
in 26 minutes and 39 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
build-host.sh
View file @
2f7eb691
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment