aboutsummaryrefslogtreecommitdiffstats
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/main.go b/main.go
index 345436f..436c7b7 100644
--- a/main.go
+++ b/main.go
@@ -1,8 +1,12 @@
package main
import (
+ "context"
"flag"
"log"
+ "os"
+ "os/signal"
+ "syscall"
)
var (
@@ -31,7 +35,10 @@ func main() {
log.Fatalf("initial sync failed: %v", err)
}
- if err := watch(*hostDir, *dataDir, manifest, rules, *dryRun, *verbose); err != nil {
+ ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
+ defer cancel()
+
+ if err := watch(ctx, *hostDir, *dataDir, manifest, rules, *dryRun, *verbose); err != nil {
log.Fatalf("watcher failed: %v", err)
}
}