From 1b8303c660754ae218fa3c3359e4bf0c2c4fdf9f Mon Sep 17 00:00:00 2001 From: Md Mushfiqur Rahim <20mahin2020@gmail.com> Date: Fri, 22 May 2026 06:10:42 +0000 Subject: [PATCH] fix: check tmpFile.Close() error in external editor --- main.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 5d54f53..eda2856 100644 --- a/main.go +++ b/main.go @@ -2774,7 +2774,12 @@ func openExternalEditor(body string) tea.Cmd { return tui.EditorFinishedMsg{Err: fmt.Errorf("writing temp file: %w", err)} } } - tmpFile.Close() + if err := tmpFile.Close(); err != nil { + os.Remove(tmpPath) + return func() tea.Msg { + return tui.EditorFinishedMsg{Err: fmt.Errorf("closing temp file: %w", err)} + } + } parts := strings.Fields(editor) args := append(parts[1:], tmpPath)