File tree Expand file tree Collapse file tree 1 file changed +24
-2
lines changed
Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -393,13 +393,35 @@ is_shell_function() {
393393 [[ -n " $name " ]] && declare -F " $name " > /dev/null 2>&1
394394}
395395
396+ is_gum_raw_mode_failure () {
397+ local err_log=" $1 "
398+ [[ -s " $err_log " ]] || return 1
399+ grep -Eiq ' setrawmode' " $err_log "
400+ }
401+
396402run_with_spinner () {
397403 local title=" $1 "
398404 shift
399405
400406 if [[ -n " $GUM " ]] && gum_is_tty && ! is_shell_function " ${1:- } " ; then
401- " $GUM " spin --spinner dot --title " $title " -- " $@ "
402- return $?
407+ local gum_err
408+ gum_err=" $( mktempfile) "
409+ if " $GUM " spin --spinner dot --title " $title " -- " $@ " 2> " $gum_err " ; then
410+ return 0
411+ fi
412+ local gum_status=$?
413+ if is_gum_raw_mode_failure " $gum_err " ; then
414+ GUM=" "
415+ GUM_STATUS=" skipped"
416+ GUM_REASON=" gum raw mode unavailable"
417+ ui_warn " Spinner unavailable in this terminal; continuing without spinner"
418+ " $@ "
419+ return $?
420+ fi
421+ if [[ -s " $gum_err " ]]; then
422+ cat " $gum_err " >&2
423+ fi
424+ return " $gum_status "
403425 fi
404426
405427 " $@ "
You can’t perform that action at this time.
0 commit comments