mirror of
https://github.com/EnumeratedDev/enit.git
synced 2026-09-16 02:26:11 +00:00
Only wait for background service processes to exit
This commit is contained in:
+2
-5
@@ -325,13 +325,8 @@ func (service *EnitService) StartService() (err error) {
|
||||
// Reload service if needed
|
||||
if service.shouldReload {
|
||||
LoadService(service.Filepath)
|
||||
if GetServiceByName(service.Name) == nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
} else {
|
||||
service.state = EnitServiceRunning
|
||||
}
|
||||
return
|
||||
}
|
||||
if !service.CrashOnSafeExit {
|
||||
@@ -423,6 +418,7 @@ func (service *EnitService) StopService() error {
|
||||
}
|
||||
}
|
||||
|
||||
if service.Type == "background" {
|
||||
// Check if the process has stopped gracefully, otherwise send sigkill on timeout
|
||||
exited := make(chan bool)
|
||||
go func() {
|
||||
@@ -440,6 +436,7 @@ func (service *EnitService) StopService() error {
|
||||
service.GetProcess().Signal(syscall.SIGKILL)
|
||||
return fmt.Errorf("could not stop process gracefully")
|
||||
}
|
||||
}
|
||||
|
||||
newServiceStatus = EnitServiceStopped
|
||||
logger.Printf("Service (%s) has stopped!\n", service.Name)
|
||||
|
||||
Reference in New Issue
Block a user