jpillora / overseer

Monitorable, gracefully restarting, self-upgrading binaries in Go (golang)
MIT License
2.32k stars 207 forks source link

[Bug] Document and expose the overseer sanity check for cases where it needs to be run manually #9

Closed tgulacsi closed 8 years ago

tgulacsi commented 8 years ago

I'm using spf13/cobra with an "update" subcommand, and the sanity check fails as it calls the binary without arguments, which means the help page is printed, instead of the token.

I can add the "missing" arg before execute, Iff I know I need it - when OVERSEER_BIN_UPD env var is set. So this constant should be exported, and the needed special behaviour of the binary documented.

jpillora commented 8 years ago

From what I understand, your command-line parsing library is showing the help text before overseer runs, so the sanity check fails, since this code never gets to execute.

I'll expose an overseer.SanityCheck() function which either does nothing or does this and a os.Exit(0).

tgulacsi commented 8 years ago

That's perfect, thanks!

jpillora commented 8 years ago

See https://godoc.org/github.com/jpillora/overseer#SanityCheck