aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pkg/updater/updater.go15
1 files changed, 9 insertions, 6 deletions
diff --git a/pkg/updater/updater.go b/pkg/updater/updater.go
index ed4938609..e4420af83 100644
--- a/pkg/updater/updater.go
+++ b/pkg/updater/updater.go
@@ -125,6 +125,15 @@ func New(cfg *Config) (*Updater, error) {
// - ensures that the current executable is fresh
// - ensures that we have a working syzkaller build in current
func (upd *Updater) UpdateOnStart(autoupdate bool, updatePending, shutdown chan struct{}) {
+ if autoupdate {
+ defer func() {
+ go func() {
+ upd.waitForUpdate()
+ close(updatePending)
+ }()
+ }()
+ }
+
os.RemoveAll(upd.currentDir)
latestTag := upd.checkLatest()
if latestTag != "" {
@@ -180,12 +189,6 @@ func (upd *Updater) UpdateOnStart(autoupdate bool, updatePending, shutdown chan
os.Exit(0)
}
}
- if autoupdate {
- go func() {
- upd.waitForUpdate()
- close(updatePending)
- }()
- }
}
// waitForUpdate polls and rebuilds syzkaller.