Skip to content

Commit

Permalink
cmd/cli: log new version when upgrading successfully
Browse files Browse the repository at this point in the history
  • Loading branch information
cuonglm committed Apr 4, 2024
1 parent 04181e0 commit c54f38e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cmd/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,15 @@ NOTE: Uninstalling will set DNS to values provided by DHCP.`,
if doRestart() {
_ = os.Remove(oldBin)
_ = os.Chmod(bin, 0755)
mainLog.Load().Notice().Msg("Upgrade successful")
ver := "unknown version"
out, err := exec.Command(bin, "--version").CombinedOutput()
if err != nil {
mainLog.Load().Warn().Err(err).Msg("Failed to get new binary version")
}
if after, found := strings.CutPrefix(string(out), "ctrld version "); found {
ver = after
}
mainLog.Load().Notice().Msgf("Upgrade successful - %s", ver)
return
}

Expand Down

0 comments on commit c54f38e

Please sign in to comment.