Browse Source

fix: Kill QEMU after 5 seconds if it hangs (#1516)

Kroese 2 weeks ago
parent
commit
4cb7e1074f
1 changed files with 5 additions and 5 deletions
  1. 5 5
      src/power.sh

+ 5 - 5
src/power.sh

@@ -82,22 +82,22 @@ finish() {
   if [ -s "$QEMU_PID" ]; then
   if [ -s "$QEMU_PID" ]; then
 
 
     pid=$(<"$QEMU_PID")
     pid=$(<"$QEMU_PID")
-    error "Forcefully terminating Windows, reason: $reason..."
+    echo && error "Forcefully terminating Windows, reason: $reason..."
     { kill -15 "$pid" || true; } 2>/dev/null
     { kill -15 "$pid" || true; } 2>/dev/null
 
 
     while isAlive "$pid"; do
     while isAlive "$pid"; do
 
 
       sleep 1
       sleep 1
       cnt=$((cnt+1))
       cnt=$((cnt+1))
-  
+
       # Workaround for zombie pid
       # Workaround for zombie pid
       [ ! -s "$QEMU_PID" ] && break
       [ ! -s "$QEMU_PID" ] && break
-  
+
       if [ "$cnt" == "5" ]; then
       if [ "$cnt" == "5" ]; then
-        error "QEMU did not terminate itself, forcefully killing process..."
+        echo && error "QEMU did not terminate itself, forcefully killing process..."
         { kill -9 "$pid" || true; } 2>/dev/null
         { kill -9 "$pid" || true; } 2>/dev/null
       fi
       fi
-  
+
     done
     done
 
 
   fi
   fi