Unverified Commit dc3bf6a0 authored by Kroese's avatar Kroese Committed by GitHub
Browse files

Update power.sh

parent 8a5fa725
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ boot() {
        grep -Fq "BOOTMGR is missing" "$QEMU_PTY" && fail="y"
      fi
      if [ -z "$fail" ]; then
        info "Windows started successfully, visit http://127.0.0.1:8006/ to view the screen..."
        info "$(app) started successfully, visit http://127.0.0.1:8006/ to view the screen..."
        return 0
      fi
    fi
@@ -84,7 +84,7 @@ finish() {
  if [ -s "$QEMU_PID" ]; then
    if read -r pid <"$QEMU_PID"; then
      if [ -n "$pid" ] && isAlive "$pid"; then
        echo && error "Forcefully terminating $app, reason: $reason..."
        echo && error "Forcefully terminating $(app), reason: $reason..."
        { kill -9 -- "$pid" || :; } 2>/dev/null
      fi
    fi
@@ -106,7 +106,7 @@ finish() {
  closeNetwork
  
  if [ -n "$pid" ] && ! waitPid "$pid" 100; then
    warn "Timed out while waiting for $app to exit!"
    warn "Timed out while waiting for $(app) to exit!"
  fi

  echo && echo "❯ Shutdown completed!"
@@ -151,7 +151,7 @@ _graceful_shutdown() {
  fi

  if ! ready; then
    info "Cannot send ACPI signal during $app setup, aborting..."
    info "Cannot send ACPI signal during $(app) setup, aborting..."
    finish "$code"
  fi

@@ -176,10 +176,10 @@ _graceful_shutdown() {

    if [ "$cnt" -ne "$abort" ]; then
      if [ "$cnt" -gt 0 ]; then
        info "Waiting for $app to shut down... ($cnt/$max)"
        info "Waiting for $(app) to shut down... ($cnt/$max)"
      fi
    else
      info "$app is still running, sending SIGTERM... ($cnt/$max)"
      info "$(app) is still running, sending SIGTERM... ($cnt/$max)"
      { kill -15 -- "$pid" || true; } 2>/dev/null
    fi