mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-07-04 01:07:49 +02:00
cmd/cli: log new version when upgrading successfully
This commit is contained in:
committed by
Cuong Manh Le
parent
56b2056190
commit
affef963c1
+9
-1
@@ -916,7 +916,15 @@ NOTE: Uninstalling will set DNS to values provided by DHCP.`,
|
|||||||
if doRestart() {
|
if doRestart() {
|
||||||
_ = os.Remove(oldBin)
|
_ = os.Remove(oldBin)
|
||||||
_ = os.Chmod(bin, 0755)
|
_ = 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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user