mount: run rclone mount in the background - fixes #723

This commit is contained in:
ishuah 2018-03-02 16:30:04 +03:00 committed by Ishuah Kariuki
parent 90af7af9a3
commit ebfeec9fb4
4 changed files with 68 additions and 4 deletions

View file

@ -0,0 +1,32 @@
// Daemonization interface for Unix variants only
// +build !windows
// +build !darwin cgo
package mountlib
import (
"log"
"github.com/sevlyar/go-daemon"
)
func startBackgroundMode() bool {
cntxt := &daemon.Context{}
d, err := cntxt.Reborn()
if err != nil {
log.Fatalln(err)
}
if d != nil {
return true
}
defer func() {
if err := cntxt.Release(); err != nil {
log.Printf("error encountered while killing daemon: %v", err)
}
}()
return false
}