From 7318568b029267359e629622d39d1b2372078545 Mon Sep 17 00:00:00 2001 From: brl Date: Sat, 13 Jun 2015 14:15:16 -0400 Subject: [PATCH] method to shutdown xpra server --- xpra/xpra.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/xpra/xpra.go b/xpra/xpra.go index 723285f..26e34b8 100644 --- a/xpra/xpra.go +++ b/xpra/xpra.go @@ -1,6 +1,7 @@ package xpra import ( + "fmt" "github.com/subgraph/oz" "os/exec" ) @@ -52,3 +53,13 @@ func getDefaultArgs(config *oz.XServerConf) []string { return args } + +func (x *Xpra) Stop() ([]byte, error) { + cmd := exec.Command("/usr/bin/xpra", + "--socket-dir="+x.WorkDir, + "stop", + fmt.Sprintf(":%d", x.Display), + ) + cmd.Env = []string{"TMPDIR=" + x.WorkDir} + return cmd.Output() +}