Skip to content

Commit

Permalink
fix: strip ANSI codes from error output in dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
adalinesimonian committed Jan 3, 2025
1 parent 8c7a951 commit 19a724d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,9 @@ exit_code=$?
# Display an error alert if gdvm failed
if [ $exit_code -ne 0 ]; then
# Strip ANSI color codes from the output
output=$(echo "$output" | sed 's/\x1B\[[0-9;]*[JKmsu]//g')
# Escape backslashes and double quotes
escaped_output=$(printf '%s' "$output" | sed 's/\\/\\\\/g; s/"/\\"/g')
Expand Down Expand Up @@ -313,6 +316,9 @@ output=$("$HOME/.gdvm/bin/godot" "$@" 2>&1)
exitCode=$?
if [ $exitCode -ne 0 ]; then
# Strip ANSI color codes from the output
output=$(echo "$output" | sed 's/\x1B\[[0-9;]*[JKmsu]//g')
zenity --error --text="$output" || \
kdialog --error "$output" || \
Xdialog --msgbox "$output" 0 0 || \
Expand Down

0 comments on commit 19a724d

Please sign in to comment.