Merge pull request #1379 from DiniFarb/win_srv_stop_error_2

This commit is contained in:
Jan-Otto Kröpke 2024-01-09 12:46:39 +01:00 committed by GitHub
commit 5398e91752
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,9 +13,7 @@ const (
serviceName = "windows_exporter"
)
type windowsExporterService struct {
stopCh chan<- bool
}
type windowsExporterService struct{}
var logger *eventlog.Log
@ -39,7 +37,6 @@ loop:
}
}
}
s.stopCh <- true
return
}
@ -63,10 +60,11 @@ func init() {
}
_ = logger.Info(100, "Attempting to start exporter service")
go func() {
err = svc.Run(serviceName, &windowsExporterService{stopCh: StopCh})
err = svc.Run(serviceName, &windowsExporterService{})
if err != nil {
_ = logger.Error(102, fmt.Sprintf("Failed to start service: %v", err))
}
StopCh <- true
}()
}
}