Skip to content

Commit

Permalink
Always run newest version of launcher on reload
Browse files Browse the repository at this point in the history
  • Loading branch information
RebeccaMahany committed Nov 21, 2023
1 parent 930bbab commit 1c142ef
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cmd/launcher/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,15 @@ func main() {
if err := runLauncher(ctx, cancel, slogger, systemSlogger, opts); err != nil {
if tuf.IsLauncherReloadNeededErr(err) {
level.Debug(logger).Log("msg", "runLauncher exited to run newer version of launcher", "err", err.Error())
runNewerLauncherIfAvailable(ctx, logger)
newerBinary, err := tuf.CheckOutLatest(ctx, "launcher", opts.RootDirectory, opts.UpdateDirectory, opts.UpdateChannel.String(), logger)
if err != nil {
logutil.Fatal(logger, "msg", "getting updated launcher", "err", err)
}
if err := execwrapper.Exec(ctx, newerBinary.Path, os.Args, os.Environ()); err != nil {
logutil.Fatal(logger, "msg", "error execing newer version of launcher", "new_binary", newerBinary, "err", err)
}

logutil.Fatal(logger, "msg", "execing newer version of launcher exited unexpectedly without error", "new_binary", newerBinary)
} else {
level.Debug(logger).Log("msg", "run launcher", "stack", fmt.Sprintf("%+v", err))
logutil.Fatal(logger, err, "run launcher")
Expand Down

0 comments on commit 1c142ef

Please sign in to comment.