From 1fa52ba1d9855afe83be41097b49ab98f2b83d67 Mon Sep 17 00:00:00 2001 From: Davies Liu Date: Fri, 15 Jan 2021 15:07:46 +0800 Subject: [PATCH] allow non-root to mount in macOS --- cmd/mount.go | 3 +-- pkg/fuse/fuse.go | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/mount.go b/cmd/mount.go index 49a5cb131069..303532c76230 100644 --- a/cmd/mount.go +++ b/cmd/mount.go @@ -178,8 +178,7 @@ func mount(c *cli.Context) error { } err = fuse.Main(conf, c.String("o"), c.Float64("attrcacheto"), c.Float64("entrycacheto"), c.Float64("direntrycacheto")) if err != nil { - logger.Errorf("%s", err) - os.Exit(1) + logger.Fatalf("fuse: %s", err) } return nil } diff --git a/pkg/fuse/fuse.go b/pkg/fuse/fuse.go index ceef2fb6e431..2efc85514802 100644 --- a/pkg/fuse/fuse.go +++ b/pkg/fuse/fuse.go @@ -25,10 +25,13 @@ import ( "github.com/juicedata/juicefs/pkg/meta" vfs "github.com/juicedata/juicefs/pkg/vfs" + "github.com/juicedata/juicesync/utils" "github.com/hanwen/go-fuse/v2/fuse" ) +var logger = utils.GetLogger("juicefs") + type JFS struct { fuse.RawFileSystem cacheMode int @@ -403,7 +406,7 @@ func (fs *JFS) StatFs(cancel <-chan struct{}, in *fuse.InHeader, out *fuse.Statf func Main(conf *vfs.Config, options string, attrcacheto_, entrycacheto_, direntrycacheto_ float64) error { if err := syscall.Setpriority(syscall.PRIO_PROCESS, os.Getpid(), -19); err != nil { - return err + logger.Warnf("setpriority: %s", err) } imp := NewJFS()