Skip to content

Commit f340ae5

Browse files
committed
Send STDERR to debug log when capturing completion output
1 parent 7438305 commit f340ae5

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

cmd/completion/completion.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,17 @@ func (c *BoshComplete) Execute(args []string) (*cobra.Command, error) {
157157
}
158158

159159
func (c *BoshComplete) ExecuteCaptured(args []string) (*CapturedResult, error) {
160-
buf := new(bytes.Buffer)
161-
c.rootCmd.SetOut(buf)
160+
outBuf := &bytes.Buffer{}
161+
errBuf := &bytes.Buffer{}
162+
163+
c.rootCmd.SetOut(outBuf)
164+
c.rootCmd.SetErr(errBuf)
162165
retCmd, err := c.Execute(args)
163166
if err != nil {
164167
return nil, err
165168
}
166-
retLines := strings.Split(buf.String(), "\n")
169+
retLines := strings.Split(outBuf.String(), "\n")
170+
c.logger.Debug("BoshComplete.ExecuteCapture() STDERR", errBuf.String())
167171
return &CapturedResult{Lines: retLines, Command: retCmd}, nil
168172
}
169173

0 commit comments

Comments
 (0)