util: log stderror in ExecCommand

all the CLI commands we execute logs the actual
error in stdError. logging stderror is using for
debugging.

Co-authored-by: Yug <yuggupta27@gmail.com>
Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna 2020-11-06 08:00:46 +05:30 committed by Madhu Rajanna
parent e99b996bea
commit eaf0058c31

View File

@ -48,7 +48,7 @@ func ExecCommand(ctx context.Context, program string, args ...string) (string, s
stderr := stderrBuf.String() stderr := stderrBuf.String()
if err != nil { if err != nil {
err = fmt.Errorf("an error (%w) occurred while running %s args: %v", err, program, sanitizedArgs) err = fmt.Errorf("an error (%w) and stdError (%s) occurred while running %s args: %v", err, stderr, program, sanitizedArgs)
if ctx != context.TODO() { if ctx != context.TODO() {
UsefulLog(ctx, "%s", err) UsefulLog(ctx, "%s", err)
} }