mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-02-24 13:46:36 +00:00
fix: Windows service can't stop without an error #1258
Signed-off-by: Dinifarb <andreas.vogt89@bluewin.ch>
This commit is contained in:
@@ -32,14 +32,14 @@ loop:
|
|||||||
changes <- c.CurrentStatus
|
changes <- c.CurrentStatus
|
||||||
case svc.Stop, svc.Shutdown:
|
case svc.Stop, svc.Shutdown:
|
||||||
_ = logger.Info(100, "Service Stop Received")
|
_ = logger.Info(100, "Service Stop Received")
|
||||||
s.stopCh <- true
|
changes <- svc.Status{State: svc.StopPending}
|
||||||
break loop
|
break loop
|
||||||
default:
|
default:
|
||||||
_ = logger.Error(102, fmt.Sprintf("unexpected control request #%d", c))
|
_ = logger.Error(102, fmt.Sprintf("unexpected control request #%d", c))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
changes <- svc.Status{State: svc.StopPending}
|
s.stopCh <- true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if isService {
|
if isService {
|
||||||
logger, err := eventlog.Open("windows_exporter")
|
logger, err = eventlog.Open("windows_exporter")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
os.Exit(2)
|
os.Exit(2)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user