elvish/pkg/daemon/daemon.go
Qi Xiao 27eec7c8ee Reorganize the daemon module.
* Move client, spawning and activation code into pkg/daemon/client.

* Move API types into pkg/daemon/daemondefs.
2021-06-19 01:06:11 +01:00

32 lines
736 B
Go

// Package daemon implements a service for mediating access to the data store,
// and its client.
//
// Most RPCs exposed by the service correspond to the methods of Store in the
// store package and are not documented here.
package daemon
import (
"os"
"src.elv.sh/pkg/logutil"
"src.elv.sh/pkg/prog"
)
var logger = logutil.GetLogger("[daemon] ")
// Program is the daemon subprogram.
var Program prog.Program = program{}
type program struct{}
func (program) ShouldRun(f *prog.Flags) bool { return f.Daemon }
func (program) Run(fds [3]*os.File, f *prog.Flags, args []string) error {
if len(args) > 0 {
return prog.BadUsage("arguments are not allowed with -daemon")
}
setUmaskForDaemon()
Serve(f.Sock, f.DB)
return nil
}