mirror of
https://github.com/kopia/kopia.git
synced 2026-03-28 11:03:44 -04:00
24 lines
341 B
Go
24 lines
341 B
Go
//go:build !windows
|
|
// +build !windows
|
|
|
|
package cli
|
|
|
|
import (
|
|
"os"
|
|
"os/signal"
|
|
"syscall"
|
|
)
|
|
|
|
// onExternalConfigReloadRequest invokes the provided function when SIGHUP is received.
|
|
func onExternalConfigReloadRequest(f func()) {
|
|
c := make(chan os.Signal, 1)
|
|
signal.Notify(c, syscall.SIGHUP)
|
|
|
|
go func() {
|
|
for {
|
|
<-c
|
|
f()
|
|
}
|
|
}()
|
|
}
|