fix: Kill QEMU after 5 seconds when it hangs

This commit is contained in:
Kroese 2025-10-19 16:58:54 +02:00 committed by GitHub
parent 5476760551
commit c33fa2f464
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -74,6 +74,7 @@ ready() {
finish() {
local pid
local cnt=0
local reason=$1
touch "$QEMU_END"
@ -85,10 +86,20 @@ finish() {
{ kill -15 "$pid" || true; } 2>/dev/null
while isAlive "$pid"; do
sleep 1
cnt=$((cnt+1))
# Workaround for zombie pid
[ ! -s "$QEMU_PID" ] && break
if [ "$cnt" == "5" ]; then
error "QEMU did not terminate itself, forcefully killing process..."
{ kill -9 "$pid" || true; } 2>/dev/null
fi
done
fi
if [ ! -f "$STORAGE/windows.boot" ] && [ -f "$BOOT" ]; then