@@ -6,6 +6,7 @@ import (
6 "math/rand"
6 "math/rand"
9 "path/filepath"
10 "path/filepath"
@@ -95,7 +96,7 @@ type OpenEditorMsg struct {
95func (m *editorCmp) openEditor(value string) tea.Cmd {
96func (m *editorCmp) openEditor(value string) tea.Cmd {
96 editor := os.Getenv("EDITOR")
97 editor := os.Getenv("EDITOR")
97 if editor == "" {
98 if editor == "" {
98− // Use platform-appropriate default editor.
99+ // Use platform-appropriate default editor
99 if runtime.GOOS == "windows" {
100 if runtime.GOOS == "windows" {
100 editor = "notepad"
101 editor = "notepad"
@@ -111,11 +112,11 @@ func (m *editorCmp) openEditor(value string) tea.Cmd {
111 if _, err := tmpfile.WriteString(value); err != nil {
112 if _, err := tmpfile.WriteString(value); err != nil {
112 return util.ReportError(err)
113 return util.ReportError(err)
115− // Build the full shell command with the file argument.
116− cmdStr := fmt.Sprintf("%s %s", editor, tmpfile.Name())
115+ c := exec.CommandContext(context.TODO(), editor, tmpfile.Name())
117−
116+ c.Stdin = os.Stdin
117+ c.Stdout = os.Stdout
118+ c.Stderr = os.Stderr
118− return util.ExecShell(context.TODO(), cmdStr, func(err error) tea.Msg {
119+ return tea.ExecProcess(c, func(err error) tea.Msg {
119 if err != nil {
120 if err != nil {
120 return util.ReportError(err)
121 return util.ReportError(err)