mirror of https://github.com/perkeep/perkeep.git
cmdmain, camput: PreExit should always run, not just in verbose mode
Change-Id: I6001a3474071a00f0ab56b031ac8c5504e5e9da5
This commit is contained in:
parent
a73715c92a
commit
593e0f0f81
|
@ -64,9 +64,11 @@ func init() {
|
|||
if up := uploader; up != nil {
|
||||
up.Close()
|
||||
stats := up.Stats()
|
||||
log.Printf("Client stats: %s", stats.String())
|
||||
if up.transport != nil {
|
||||
log.Printf(" #HTTP reqs: %d", up.transport.Requests())
|
||||
if *cmdmain.FlagVerbose {
|
||||
log.Printf("Client stats: %s", stats.String())
|
||||
if up.transport != nil {
|
||||
log.Printf(" #HTTP reqs: %d", up.transport.Requests())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,8 +41,8 @@ var (
|
|||
// ExtraFlagRegistration allows to add more flags from
|
||||
// other packages (with AddFlags) when Main starts.
|
||||
ExtraFlagRegistration = func() {}
|
||||
// PreExit is meant to dump additional stats and other
|
||||
// verbiage before Main terminates.
|
||||
// PreExit runs after the subcommand, but before Main terminates
|
||||
// with either success or the error from the subcommand.
|
||||
PreExit = func() {}
|
||||
// ExitWithFailure determines whether the command exits
|
||||
// with a non-zero exit status.
|
||||
|
@ -278,9 +278,7 @@ func Main() {
|
|||
}
|
||||
Exit(1)
|
||||
}
|
||||
if *FlagVerbose {
|
||||
PreExit()
|
||||
}
|
||||
PreExit()
|
||||
if err != nil {
|
||||
if !ExitWithFailure {
|
||||
// because it was already logged if ExitWithFailure
|
||||
|
|
Loading…
Reference in New Issue