returning stderr

Signed-off-by: Richard Jones <richard@dagger.io>
This commit is contained in:
Richard Jones
2022-01-11 14:39:18 -07:00
parent 9b4c92ad84
commit 95542d29cb
3 changed files with 46 additions and 10 deletions

View File

@@ -2,6 +2,7 @@ package task
import (
"context"
"errors"
"fmt"
"os"
"os/exec"
@@ -49,6 +50,10 @@ func (c *inputSecretExecTask) Run(ctx context.Context, pctx *plancontext.Context
// sec audited by @aluzzardi and @mrjones
out, err := cmd.Output()
if err != nil {
var exitErr *exec.ExitError
if errors.As(err, &exitErr) {
return nil, errors.New(string(exitErr.Stderr))
}
return nil, err
}