From 1659fed99fdfeea53fa0d1da9da4fc3f7591116b Mon Sep 17 00:00:00 2001 From: Steve Moyer Date: Fri, 27 May 2022 11:15:35 -0400 Subject: test(778): capture stderr and stdout during tests --- commands/env.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'commands/env.go') diff --git a/commands/env.go b/commands/env.go index ac7b789a..98a7e1a5 100644 --- a/commands/env.go +++ b/commands/env.go @@ -141,6 +141,9 @@ func loadBackendEnsureUser(env *Env) func(*cobra.Command, []string) error { // This wrapper style is necessary because a Cobra PostE function does not run if RunE return an error. func closeBackend(env *Env, runE func(cmd *cobra.Command, args []string) error) func(*cobra.Command, []string) error { return func(cmd *cobra.Command, args []string) error { + env.err = out{Writer: cmd.ErrOrStderr()} + env.out = out{Writer: cmd.OutOrStdout()} + errRun := runE(cmd, args) if env.backend == nil { -- cgit