elvish/pkg/daemon/sys_unix.go
Qi Xiao 8e117a2875 Merge pkg/daemon/client into pkg/daemon.
Also merge and rename files to make the client/server separation clearer.
2021-09-30 23:37:36 +01:00

26 lines
482 B
Go

//go:build !windows && !plan9 && !js
// +build !windows,!plan9,!js
package daemon
import (
"os"
"syscall"
"golang.org/x/sys/unix"
)
// Make sure that files created by the daemon is not accessible to other users.
func setUmaskForDaemon() { unix.Umask(0077) }
func procAttrForSpawn(files []*os.File) *os.ProcAttr {
return &os.ProcAttr{
Dir: "/",
Env: []string{},
Files: files,
Sys: &syscall.SysProcAttr{
Setsid: true, // detach from current terminal
},
}
}