summaryrefslogtreecommitdiff
path: root/unix.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-02-12 15:27:40 -0600
committerJeff Carr <[email protected]>2024-02-12 15:27:40 -0600
commitb4a571fb70905d69161b204784fff77517ee5022 (patch)
tree7d4c6f32ab7578dca2948e8a84b35b307544b5e7 /unix.go
parentba4051cb0c0f253a41d2b7675fc4e37872230df4 (diff)
add option to spawn xterm. used for this commit
Diffstat (limited to 'unix.go')
-rw-r--r--unix.go60
1 files changed, 60 insertions, 0 deletions
diff --git a/unix.go b/unix.go
index 0b2df4b..8af9871 100644
--- a/unix.go
+++ b/unix.go
@@ -321,3 +321,63 @@ func formatDuration(d time.Duration) string {
}
return result
}
+
+func (rs *RepoStatus) XtermNohup(args []string) {
+ var argsX = []string{"xterm", "-geometry", "120x40"}
+ /*
+ if xtermHold.Checked() {
+ log.Println("hold = true")
+ argsXterm = append(argsXterm, "-hold")
+ } else {
+ log.Println("hold = false")
+ }
+ */
+ argsX = append(argsX, "-e", "bash", "-c")
+ 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("nohup", argsX...)
+ path := rs.realPath.String()
+ cmd.Dir = path
+ log.Info("path =", path)
+ log.Info("cmd =", strings.Join(args, " "))
+ if err := cmd.Run(); err != nil {
+ log.Info("xterm.Run() failed")
+ log.Info("path =", path)
+ log.Info("cmd =", argsX)
+ } else {
+ log.Info("xterm.Run() worked")
+ log.Info("path =", path)
+ log.Info("cmd =", argsX)
+ }
+}
+
+func (rs *RepoStatus) Xterm(args []string) {
+ var argsX = []string{"-geometry", "120x40"}
+ /*
+ if xtermHold.Checked() {
+ log.Println("hold = true")
+ argsXterm = append(argsXterm, "-hold")
+ } else {
+ log.Println("hold = false")
+ }
+ */
+ argsX = append(argsX, "-e", "bash", "-c")
+ 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.realPath.String()
+ cmd.Dir = path
+ if err := cmd.Run(); err != nil {
+ log.Info("xterm.Run() failed")
+ log.Info("path =", path)
+ log.Info("cmd = xterm", argsX)
+ } else {
+ log.Info("xterm.Run() worked")
+ log.Info("path =", path)
+ log.Info("cmd = xterm", argsX)
+ }
+}