Pass proper creds to xpra.Stop()

master
xSmurf 10 years ago
parent ce1026bced
commit 2313bd6a34

@ -9,6 +9,7 @@ import (
"os/user" "os/user"
"path" "path"
"strconv" "strconv"
"syscall"
) )
type Xpra struct { type Xpra struct {
@ -59,12 +60,15 @@ func getDefaultArgs(config *oz.XServerConf) []string {
return args return args
} }
func (x *Xpra) Stop() ([]byte, error) { func (x *Xpra) Stop(cred *syscall.Credential) ([]byte, error) {
cmd := exec.Command("/usr/bin/xpra", cmd := exec.Command("/usr/bin/xpra",
"--socket-dir="+x.WorkDir, "--socket-dir="+x.WorkDir,
"stop", "stop",
fmt.Sprintf(":%d", x.Display), fmt.Sprintf(":%d", x.Display),
) )
cmd.SysProcAttr = &syscall.SysProcAttr{
Credential: cred,
}
cmd.Env = []string{"TMPDIR=" + x.WorkDir} cmd.Env = []string{"TMPDIR=" + x.WorkDir}
return cmd.Output() return cmd.Output()
} }

Loading…
Cancel
Save