fix(upgrade): stop progress before exit

resolves #5213
This commit is contained in:
Jan De Dobbeleer 2024-07-06 10:26:18 +02:00 committed by Jan De Dobbeleer
parent 8b6933160a
commit 37b8e55131

View file

@ -41,11 +41,10 @@ var upgradeCmd = &cobra.Command{
terminal.Init(env.Shell()) terminal.Init(env.Shell())
fmt.Print(terminal.StartProgress()) fmt.Print(terminal.StartProgress())
defer fmt.Print(terminal.StopProgress())
latest, err := upgrade.Latest(env) latest, err := upgrade.Latest(env)
if err != nil { if err != nil {
fmt.Printf("\n❌ %s\n\n", err) fmt.Printf("\n❌ %s\n\n", err)
terminal.StopProgress()
os.Exit(1) os.Exit(1)
return return
} }
@ -63,6 +62,8 @@ var upgradeCmd = &cobra.Command{
if !cfg.DisableNotice { if !cfg.DisableNotice {
fmt.Print("\n✅ no new version available\n\n") fmt.Print("\n✅ no new version available\n\n")
} }
terminal.StopProgress()
return return
} }
@ -77,6 +78,7 @@ func executeUpgrade(latest string) {
} }
fmt.Printf("\n❌ %s\n\n", err) fmt.Printf("\n❌ %s\n\n", err)
terminal.StopProgress()
os.Exit(1) os.Exit(1)
} }