github.com/elves/elvish@v0.15.0/pkg/daemon/daemon.go (about) 1 // Package daemon implements a service for mediating access to the data store, 2 // and its client. 3 // 4 // Most RPCs exposed by the service correspond to the methods of Store in the 5 // store package and are not documented here. 6 package daemon 7 8 import ( 9 "os" 10 11 "github.com/elves/elvish/pkg/logutil" 12 "github.com/elves/elvish/pkg/prog" 13 ) 14 15 var logger = logutil.GetLogger("[daemon] ") 16 17 // Version is the API version. It should be bumped any time the API changes. 18 const Version = -93 19 20 // Program is the daemon subprogram. 21 var Program prog.Program = program{} 22 23 type program struct{} 24 25 func (program) ShouldRun(f *prog.Flags) bool { return f.Daemon } 26 27 func (program) Run(fds [3]*os.File, f *prog.Flags, args []string) error { 28 if len(args) > 0 { 29 return prog.BadUsage("arguments are not allowed with -daemon") 30 } 31 setUmaskForDaemon() 32 Serve(f.Sock, f.DB) 33 return nil 34 }