diff --git a/internal/execext/exec.go b/internal/execext/exec.go index 6ac9b1ad..851fd2bd 100644 --- a/internal/execext/exec.go +++ b/internal/execext/exec.go @@ -27,18 +27,8 @@ type RunCommandOptions struct { var ( // ErrNilOptions is returned when a nil options is given ErrNilOptions = errors.New("execext: nil options given") - - setMinusE *syntax.File ) -func init() { - var err error - setMinusE, err = syntax.NewParser().Parse(strings.NewReader("set -e"), "") - if err != nil { - panic(err) - } -} - // RunCommand runs a shell command func RunCommand(ctx context.Context, opts *RunCommandOptions) error { if opts == nil { @@ -56,6 +46,7 @@ func RunCommand(ctx context.Context, opts *RunCommandOptions) error { } r, err := interp.New( + interp.Params("-e"), interp.Dir(opts.Dir), interp.Env(expand.ListEnviron(environ...)), interp.OpenHandler(openHandler), @@ -64,9 +55,6 @@ func RunCommand(ctx context.Context, opts *RunCommandOptions) error { if err != nil { return err } - if err = r.Run(ctx, setMinusE); err != nil { - return err - } return r.Run(ctx, p) }