Skip to content

Commit 19a724d

Browse files
fix: strip ANSI codes from error output in dialogs
1 parent 8c7a951 commit 19a724d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

scripts/install.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,9 @@ exit_code=$?
234234
235235
# Display an error alert if gdvm failed
236236
if [ $exit_code -ne 0 ]; then
237+
# Strip ANSI color codes from the output
238+
output=$(echo "$output" | sed 's/\x1B\[[0-9;]*[JKmsu]//g')
239+
237240
# Escape backslashes and double quotes
238241
escaped_output=$(printf '%s' "$output" | sed 's/\\/\\\\/g; s/"/\\"/g')
239242
@@ -313,6 +316,9 @@ output=$("$HOME/.gdvm/bin/godot" "$@" 2>&1)
313316
exitCode=$?
314317
315318
if [ $exitCode -ne 0 ]; then
319+
# Strip ANSI color codes from the output
320+
output=$(echo "$output" | sed 's/\x1B\[[0-9;]*[JKmsu]//g')
321+
316322
zenity --error --text="$output" || \
317323
kdialog --error "$output" || \
318324
Xdialog --msgbox "$output" 0 0 || \

0 commit comments

Comments
 (0)