repolist/xterm.go

65 lines
1.7 KiB
Go

package repolist
import (
"go.wit.com/lib/gui/shell"
"go.wit.com/log"
)
func (rs *RepoRow) XtermNohup(cmdline string) {
p := rs.pb.GetFullPath()
var xterm []string
xterm = append(xterm, me.forge.Config.Xterm)
xterm = append(xterm, me.forge.Config.XtermArgv...)
xterm = append(xterm, "bash")
xterm = append(xterm, "-c")
xterm = append(xterm, cmdline)
shell.XtermCmd(p, xterm)
}
func (rs *RepoRow) Xterm(cmdline string) {
p := rs.pb.GetFullPath()
var xterm []string
xterm = append(xterm, me.forge.Config.Xterm)
xterm = append(xterm, me.forge.Config.XtermArgv...)
xterm = append(xterm, "bash")
xterm = append(xterm, "-c")
xterm = append(xterm, cmdline)
shell.XtermCmd(p, xterm)
}
func (rs *RepoRow) XtermWait(cmdline string) {
p := rs.pb.GetFullPath()
var xterm []string
xterm = append(xterm, me.forge.Config.Xterm)
xterm = append(xterm, me.forge.Config.XtermArgv...)
xterm = append(xterm, "bash")
xterm = append(xterm, "-c")
xterm = append(xterm, cmdline)
log.Info("repolist.XtermWait()", p, cmdline)
shell.XtermCmdWait(p, xterm)
}
/*
func (rs *RepoRow) XtermBash(args []string) {
var argsX = []string{"-geometry", "120x40"}
tmp := strings.Join(args, " ") + ";bash"
argsX = append(argsX, "-e", "bash", "-c", tmp)
argsX = append(argsX, args...)
log.Info("xterm cmd=", argsX)
// set less to not exit on small diff's
os.Setenv("LESS", "-+F -+X -R")
cmd := exec.Command("xterm", argsX...)
path := rs.pb.GetFullPath()
cmd.Dir = path
if err := cmd.Run(); err != nil {
log.Log(WARN, "xterm.Run() failed")
log.Log(WARN, "path =", path)
log.Log(WARN, "cmd = xterm", argsX)
} else {
log.Log(WARN, "xterm.Run() worked")
log.Log(WARN, "path =", path)
log.Log(WARN, "cmd = xterm", argsX)
}
}
*/