From 0016e441ebc803cac346e11312470cb642be3eb4 Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Thu, 10 Jul 2025 10:31:09 -0400 Subject: [PATCH] chore(tui): editor: return error on write failure --- internal/tui/components/chat/editor/editor.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/tui/components/chat/editor/editor.go b/internal/tui/components/chat/editor/editor.go index 4b94900903cce6dc5105d384e78e200301c3fc2d..5f8a3548aa47810c3583f6d2b6a6c184809ba178 100644 --- a/internal/tui/components/chat/editor/editor.go +++ b/internal/tui/components/chat/editor/editor.go @@ -82,8 +82,10 @@ func (m *editorCmp) openEditor(value string) tea.Cmd { if err != nil { return util.ReportError(err) } - _, _ = tmpfile.WriteString(value) - tmpfile.Close() + defer tmpfile.Close() //nolint:errcheck + if _, err := tmpfile.WriteString(value); err != nil { + return util.ReportError(err) + } c := exec.Command(editor, tmpfile.Name()) c.Stdin = os.Stdin c.Stdout = os.Stdout