Skip to content

Commit 398a2c5

Browse files
committed
Fix instantiation of parser
Seems that the parser cannot be reused. Some tests were ramdomly failing.
1 parent 2615000 commit 398a2c5

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

execext/exec.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ type RunCommandOptions struct {
2424
var (
2525
// ErrNilOptions is returned when a nil options is given
2626
ErrNilOptions = errors.New("execext: nil options given")
27-
28-
parser = syntax.NewParser()
2927
)
3028

3129
// RunCommand runs a shell command
@@ -34,7 +32,7 @@ func RunCommand(opts *RunCommandOptions) error {
3432
return ErrNilOptions
3533
}
3634

37-
p, err := parser.Parse(strings.NewReader(opts.Command), "")
35+
p, err := syntax.NewParser().Parse(strings.NewReader(opts.Command), "")
3836
if err != nil {
3937
return err
4038
}

0 commit comments

Comments
 (0)