Fixes issue where spinner message is not shown for FDW update. Closes #643

This commit is contained in:
Binaek Sarkar
2021-07-19 18:12:02 +05:30
committed by GitHub
parent 2b0ed2692b
commit 901ec350bd
2 changed files with 5 additions and 4 deletions

View File

@@ -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 {

View File

@@ -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)
}