2020-05-04 18:09:10 +00:00
|
|
|
// +build windows
|
|
|
|
|
|
|
|
package shim
|
|
|
|
|
|
|
|
import (
|
2020-05-05 14:14:57 +00:00
|
|
|
"context"
|
2020-05-04 18:09:10 +00:00
|
|
|
"os"
|
|
|
|
"os/signal"
|
|
|
|
"syscall"
|
|
|
|
)
|
|
|
|
|
2020-05-05 14:14:57 +00:00
|
|
|
func listenForCollectMetricsSignals(ctx context.Context, collectMetricsPrompt chan os.Signal) {
|
2020-05-04 18:09:10 +00:00
|
|
|
signal.Notify(collectMetricsPrompt, syscall.SIGHUP)
|
2020-05-05 14:14:57 +00:00
|
|
|
|
|
|
|
go func() {
|
|
|
|
select {
|
|
|
|
case <-ctx.Done():
|
|
|
|
// context done. stop to signals to avoid pushing messages to a closed channel
|
|
|
|
signal.Stop(collectMetricsPrompt)
|
|
|
|
}
|
|
|
|
}()
|
2020-05-04 18:09:10 +00:00
|
|
|
}
|