mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-02-03 22:18:39 +00:00
cmd/cli: log new version when upgrading successfully
This commit is contained in:
committed by
Cuong Manh Le
parent
56b2056190
commit
affef963c1
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user