(Windows) fix: UI restart – do not send "shutdown" event during restart
This commit is contained in:
@@ -94,6 +94,7 @@ func (s *WindowsSystemService) Execute(args []string, changeRequests <-chan svc.
|
|||||||
syscall.SIGTERM,
|
syscall.SIGTERM,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
isShuttingDown := false
|
||||||
// Wait for shutdown signal.
|
// Wait for shutdown signal.
|
||||||
waitSignal:
|
waitSignal:
|
||||||
for {
|
for {
|
||||||
@@ -119,12 +120,16 @@ waitSignal:
|
|||||||
}
|
}
|
||||||
|
|
||||||
case <-s.instance.ShuttingDown():
|
case <-s.instance.ShuttingDown():
|
||||||
|
isShuttingDown = true
|
||||||
break waitSignal
|
break waitSignal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Trigger shutdown.
|
// Trigger shutdown,
|
||||||
s.instance.Shutdown()
|
// but only if we are not already shutting down.
|
||||||
|
if !isShuttingDown {
|
||||||
|
s.instance.Shutdown()
|
||||||
|
}
|
||||||
|
|
||||||
// Notify the service host that service is in shutting down state.
|
// Notify the service host that service is in shutting down state.
|
||||||
changes <- svc.Status{State: svc.StopPending}
|
changes <- svc.Status{State: svc.StopPending}
|
||||||
|
|||||||
Reference in New Issue
Block a user