Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/internal/handle_panel_movement.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ func (m *model) executeOpenCommand() {
}

cmd := exec.Command(openCommand, panel.element[panel.cursor].location)
utils.DetachFromTerminal(cmd)
err := cmd.Start()
if err != nil {
slog.Error("Error while open file with", "error", err)
Expand Down
17 changes: 17 additions & 0 deletions src/internal/utils/detach_unix.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//go:build !windows

package utils

import (
"os/exec"
"syscall"
)

func DetachFromTerminal(cmd *exec.Cmd) {
// Start new session so child isn't tied to the TTY (prevents SIGHUP on terminal close).
cmd.SysProcAttr = &syscall.SysProcAttr{Setsid: true}
// Optionally, redirect stdio to avoid terminal hangups
cmd.Stdin = nil
cmd.Stdout = nil
cmd.Stderr = nil
}
10 changes: 10 additions & 0 deletions src/internal/utils/detach_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//go:build windows

package utils

import "os/exec"

func DetachFromTerminal(cmd *exec.Cmd) {
// No-op: current Windows path uses rundll32 and returns immediately.
// If needed later, set CreationFlags/HideWindow via syscall.SysProcAttr.
}
Loading