mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-14 02:57:52 +08:00
27eec7c8ee
* Move client, spawning and activation code into pkg/daemon/client. * Move API types into pkg/daemon/daemondefs.
32 lines
736 B
Go
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
|
|
}
|