Skip to content

Commit

Permalink
chore(deps): update exec.go to go-task/task:a2f8adb
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc Siebeneicher authored and msiebeneicher committed Aug 21, 2023
1 parent c0cd87c commit 7612109
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions pkg/common/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@ type RunCommandOptions struct {
Stderr io.Writer
}

var (
// ErrNilOptions is returned when a nil options is given
ErrNilOptions = errors.New("execext: nil options given")
)
// ErrNilOptions is returned when a nil options is given
var ErrNilOptions = errors.New("execext: nil options given")

// RunCommand runs a shell command
func RunCommand(ctx context.Context, opts *RunCommandOptions) error {
Expand Down Expand Up @@ -62,7 +60,7 @@ func RunCommand(ctx context.Context, opts *RunCommandOptions) error {
r, err := interp.New(
interp.Params(params...),
interp.Env(expand.ListEnviron(environ...)),
interp.ExecHandler(interp.DefaultExecHandler(15*time.Second)),
interp.ExecHandlers(execHandler),
interp.OpenHandler(openHandler),
interp.StdIO(opts.Stdin, opts.Stdout, opts.Stderr),
dirOption(opts.Dir),
Expand Down Expand Up @@ -116,6 +114,10 @@ func Expand(s string) (string, error) {
return "", nil
}

func execHandler(next interp.ExecHandlerFunc) interp.ExecHandlerFunc {
return interp.DefaultExecHandler(15 * time.Second)
}

func openHandler(ctx context.Context, path string, flag int, perm os.FileMode) (io.ReadWriteCloser, error) {
if path == "/dev/null" {
return devNull{}, nil
Expand Down

0 comments on commit 7612109

Please sign in to comment.