From 8d3e30ca69585a3f97a05fc6d6262598b21722fb Mon Sep 17 00:00:00 2001 From: Jordan Krage Date: Wed, 30 Aug 2017 11:15:28 -0500 Subject: [PATCH] gps: cmd: add command args to monitoredCmd errors --- internal/gps/cmd.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/internal/gps/cmd.go b/internal/gps/cmd.go index 7b8fcb07..799f1685 100644 --- a/internal/gps/cmd.go +++ b/internal/gps/cmd.go @@ -14,6 +14,7 @@ import ( "time" "github.com/Masterminds/vcs" + "github.com/pkg/errors" ) // monitoredCmd wraps a cmd and will keep monitoring the process until it @@ -127,11 +128,8 @@ func (c *monitoredCmd) hasTimedOut() bool { func (c *monitoredCmd) combinedOutput(ctx context.Context) ([]byte, error) { c.cmd.Stderr = c.stdout - if err := c.run(ctx); err != nil { - return c.stdout.Bytes(), err - } - - return c.stdout.Bytes(), nil + err := c.run(ctx) + return c.stdout.Bytes(), errors.Wrapf(err, "command failed: %v", c.cmd.Args) } // activityBuffer is a buffer that keeps track of the last time a Write