Evanulate if cache daemon should be skipped after the flags are parsed (#4168)

This commit is contained in:
Todd authored and Johan Brandhorst-Satzkorn committed 2024-01-05 07:43:21 -08:00
1 parent 8175086be7
commit 6f488d7c59
1 file changed
+3 -4
@@ -42,14 +42,13 @@ func Wrap(c cacheEnabledCommand) cli.CommandFactory {
// Run runs the wrapped command and then attempts to start the boundary daemon and send
// the current persona
func (w *CommandWrapper) Run(args []string) int {
if w.BaseCommand().FlagSkipCacheDaemon {
return w.cacheEnabledCommand.Run(args)
}
// potentially intercept the token in case it isn't stored in the keyring
var token string
w.cacheEnabledCommand.BaseCommand().Opts = append(w.cacheEnabledCommand.BaseCommand().Opts, base.WithInterceptedToken(&token))
r := w.cacheEnabledCommand.Run(args)
if w.BaseCommand().FlagSkipCacheDaemon {
return r
}
if r != base.CommandSuccess {
// if we were not successful in running our command, do not continue to