This commit is contained in:
2026-01-24 12:36:47 +01:00
parent 25a57cf8f1
commit e6d062e75d
+10 -9
View File
@@ -93,17 +93,11 @@ func main() {
} }
} }
var sessionCache = make(map[string]bool)
func HasSession(seshName string) bool { func HasSession(seshName string) bool {
has, ok := sessionCache[seshName]
if ok {
return has
}
res := exec.Command(tmux, "has-session", "-t", seshName).Run() res := exec.Command(tmux, "has-session", "-t", seshName).Run()
has = res == nil return res == nil
sessionCache[seshName] = has
return has
} }
func expandTilde(path string) (string, error) { func expandTilde(path string) (string, error) {
if !strings.HasPrefix(path, "~") { if !strings.HasPrefix(path, "~") {
return path, nil return path, nil
@@ -134,7 +128,14 @@ func NewWindowInSession(seshName string, window Window) {
if window.Program != "" { if window.Program != "" {
args = append(args, window.Program) args = append(args, window.Program)
} }
exec.Command(tmux, args...).Run() cmd := exec.Command(tmux, args...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.Stdin = os.Stdin
err := cmd.Run()
if err != nil {
panic(err)
}
} }
func TurnIntoTmux(sessionName string) { func TurnIntoTmux(sessionName string) {