summaryrefslogtreecommitdiff
path: root/xterm.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-01 15:33:08 -0600
committerJeff Carr <[email protected]>2024-01-01 15:33:08 -0600
commitf03f76bc082a245f852dcd0cc52fef9ff48cdc93 (patch)
tree5e63087bc7cd1fe22743a4b60d120121ce0f7886 /xterm.go
initial commit
Diffstat (limited to 'xterm.go')
-rw-r--r--xterm.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/xterm.go b/xterm.go
new file mode 100644
index 0000000..5c94560
--- /dev/null
+++ b/xterm.go
@@ -0,0 +1,31 @@
+package digitalocean
+
+import (
+ "os/exec"
+ "go.wit.com/log"
+)
+
+var geom string = "120x30+500+500"
+
+func xterm(cmd string) {
+ var tmp []string
+ var argsXterm = []string{"nohup", "xterm", "-geometry", geom}
+ // tmp = append(argsXterm, "-hold", "-e", cmd)
+ tmp = append(argsXterm, "-e", cmd)
+ log.Println("xterm cmd=", cmd)
+ go runCommand(tmp)
+}
+
+func runCommand(cmdArgs []string) {
+ log.Println("runCommand() START", cmdArgs)
+ process := exec.Command(cmdArgs[0], cmdArgs[1:len(cmdArgs)]...)
+ // process := exec.Command("xterm", "-e", "ping localhost")
+ log.Println("runCommand() process.Start()")
+ process.Start()
+ log.Println("runCommand() process.Wait()")
+ err := process.Wait()
+ log.Error(err, "on process.Wait")
+ log.Println("runCommand() NEED TO CHECK THE TIME HERE TO SEE IF THIS WORKED")
+ log.Println("runCommand() OTHERWISE INFORM THE USER")
+ log.Println("runCommand() END", cmdArgs)
+}