diff --git a/qemu/rootfs/sbin/init b/qemu/rootfs/sbin/init index 2a52105..9ab1638 100755 --- a/qemu/rootfs/sbin/init +++ b/qemu/rootfs/sbin/init @@ -195,11 +195,19 @@ if grep -qw warden.ctl /proc/cmdline && [ -c /dev/ttyS0 ]; then ;; *) if [ -p /tmp/warden-ui.ctl ]; then + # Remove the previous reply BEFORE sending, then wait + # for the new one to appear (the UI renames it into + # place whole). A fixed settle used to hand back the + # previous command's reply whenever a page took longer + # than 0.3 s to build (flare-edge #152); this is the + # same recipe tools/warden-ctl uses over SSH. + rm -f /tmp/warden-ui.dbg printf '%s\n' "$cmd" > /tmp/warden-ui.ctl - # The UI polls its FIFO every 100 ms and truncates the - # reply file on each command, so a short settle then a - # read is the same protocol warden-ctl uses over SSH. - sleep 0.3 + n=0 + while [ ! -s /tmp/warden-ui.dbg ] && [ "$n" -lt 100 ]; do + sleep 0.05 + n=$((n + 1)) + done cat /tmp/warden-ui.dbg 2>/dev/null >&3 else echo "bridge: warden-ui control FIFO not present" >&3