diff --git a/db/install.go b/db/install.go index df8b8f736..d62ccb845 100644 --- a/db/install.go +++ b/db/install.go @@ -41,10 +41,10 @@ func EnsureDBInstalled() { if fdwNeedsUpdate() { _, err := installFDW(false, spinner) if err != nil { - display.StopSpinner(spinner) utils.FailOnError(err) } + spinner.Stop() fmt.Printf("%s was updated to %s. ", constants.Bold("steampipe-postgres-fdw"), constants.Bold(constants.FdwVersion)) currentStatus, err := GetStatus() if err != nil || currentStatus != nil { @@ -55,6 +55,7 @@ func EnsureDBInstalled() { } if needsInit() { + spinner.Start() display.UpdateSpinnerMessage(spinner, "Cleanup any Steampipe processes...") killInstanceIfAny() if err := doInit(false, spinner); err != nil { diff --git a/display/spinner.go b/display/spinner.go index dea3bf7e4..d875adaa5 100644 --- a/display/spinner.go +++ b/display/spinner.go @@ -86,7 +86,7 @@ func ShowSpinner(msg string) *spinner.Spinner { // StopSpinnerWithMessage stops a spinner instance and clears it, after writing `finalMsg` func StopSpinnerWithMessage(spinner *spinner.Spinner, finalMsg string) { - if spinner != nil && spinner.Active() { + if spinner != nil { spinner.FinalMSG = finalMsg spinner.Stop() } @@ -94,14 +94,14 @@ func StopSpinnerWithMessage(spinner *spinner.Spinner, finalMsg string) { // StopSpinner stops a spinner instance and clears it func StopSpinner(spinner *spinner.Spinner) { - if spinner != nil && spinner.Active() { + if spinner != nil { spinner.Stop() } } // UpdateSpinnerMessage updates the message of the given spinner func UpdateSpinnerMessage(spinner *spinner.Spinner, newMessage string) { - if spinner != nil && spinner.Active() { + if spinner != nil { newMessage = truncateSpinnerMessageToScreen(newMessage) spinner.Suffix = fmt.Sprintf(" %s", newMessage) }