Skip to content

Commit f72d1c4

Browse files
fix: fix child process spawning attached
Fixes #1083
1 parent bd79f4d commit f72d1c4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/internal/handle_panel_movement.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"os/exec"
77
"path/filepath"
88
"runtime"
9+
"syscall"
910

1011
tea "github.com/charmbracelet/bubbletea"
1112

@@ -97,6 +98,13 @@ func (m *model) executeOpenCommand() {
9798
}
9899

99100
cmd := exec.Command(openCommand, panel.element[panel.cursor].location)
101+
if runtime.GOOS != "windows" {
102+
cmd.SysProcAttr = &syscall.SysProcAttr{Setsid: true}
103+
// Optionally, redirect stdio to avoid terminal hangups
104+
cmd.Stdin = nil
105+
cmd.Stdout = nil
106+
cmd.Stderr = nil
107+
}
100108
err := cmd.Start()
101109
if err != nil {
102110
slog.Error("Error while open file with", "error", err)

0 commit comments

Comments
 (0)