From fb543c3294f7d8e918bdf8b7a9da74e648cf6f45 Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Mon, 9 Dec 2024 14:44:43 -0300 Subject: [PATCH] fix: strip ansi sequences from stdin (#739) Signed-off-by: Carlos Alexandro Becker --- internal/stdin/stdin.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/stdin/stdin.go b/internal/stdin/stdin.go index 1a1b0f3a3..26c73881a 100644 --- a/internal/stdin/stdin.go +++ b/internal/stdin/stdin.go @@ -6,6 +6,8 @@ import ( "io" "os" "strings" + + "github.com/charmbracelet/x/ansi" ) // Read reads input from an stdin pipe. @@ -28,7 +30,7 @@ func Read() (string, error) { } } - return strings.TrimSuffix(b.String(), "\n"), nil + return strings.TrimSuffix(ansi.Strip(b.String()), "\n"), nil } // IsEmpty returns whether stdin is empty.