Fix a regression that broke kitten update-self

Fixes #6729
This commit is contained in:
Kovid Goyal
2023-10-18 19:19:35 +05:30
parent 0300a355d0
commit a9b412baba
5 changed files with 19 additions and 16 deletions

View File

@@ -4,11 +4,11 @@ package update_self
import (
"fmt"
"kitty"
"os"
"path/filepath"
"runtime"
"kitty"
"kitty/tools/cli"
"kitty/tools/tty"
"kitty/tools/tui"
@@ -33,7 +33,7 @@ func update_self(version string) (err error) {
if err != nil {
return err
}
if !kitty.IsStandaloneBuild {
if kitty.IsStandaloneBuild == "" {
return fmt.Errorf("This is not a standalone kitten executable. You must update all of kitty instead.")
}
rv := "v" + version

View File

@@ -139,7 +139,14 @@ func DownloadFileWithProgress(destpath, url string, kill_if_signaled bool) (err
}
}
on_timer_tick := func(timer_id loop.IdType) error {
return lp.OnWakeup()
}
lp.OnInitialize = func() (string, error) {
if _, err = lp.AddTimer(rd.spinner.interval, true, on_timer_tick); err != nil {
return "", err
}
go do_download()
lp.QueueWriteString("Downloading: " + url + "\r\n")
return "\r\n", nil
@@ -179,13 +186,6 @@ func DownloadFileWithProgress(destpath, url string, kill_if_signaled bool) (err
return nil
}
on_timer_tick := func(timer_id loop.IdType) error {
return lp.OnWakeup()
}
if _, err = lp.AddTimer(rd.spinner.interval, true, on_timer_tick); err != nil {
return
}
err = lp.Run()
dl_data.mutex.Lock()
if dl_data.temp_file_path != "" && !dl_data.download_finished {