]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Handle repeat SIGINT/SIGTERMs
authorMatt Joiner <anacrolix@gmail.com>
Tue, 8 Apr 2014 15:17:53 +0000 (01:17 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Tue, 8 Apr 2014 15:17:53 +0000 (01:17 +1000)
Need to determine if there's a way to better interrupt the FS or if we have no control over that.

cmd/torrentfs/main.go

index 694c8938bb03937892ddc34e28cb137b530a04b7..b55a7a0892f381b9e85c4d2b2a4160706bf642f7 100644 (file)
@@ -57,8 +57,13 @@ func setSignalHandlers() {
        c := make(chan os.Signal)
        signal.Notify(c, syscall.SIGINT, syscall.SIGTERM)
        go func() {
-               <-c
-               fuse.Unmount(mountDir)
+               for {
+                       <-c
+                       err := fuse.Unmount(mountDir)
+                       if err != nil {
+                               log.Print(err)
+                       }
+               }
        }()
 }