Handle ignore_error one level up on the code

This commit is contained in:
Andrey Nering
2018-08-05 12:40:11 -03:00
parent 550c116aea
commit c70343a5bc
2 changed files with 22 additions and 25 deletions

View File

@@ -13,14 +13,13 @@ import (
// RunCommandOptions is the options for the RunCommand func
type RunCommandOptions struct {
Context context.Context
Command string
Dir string
Env []string
Stdin io.Reader
Stdout io.Writer
Stderr io.Writer
IgnoreErrorCode bool
Context context.Context
Command string
Dir string
Env []string
Stdin io.Reader
Stdout io.Writer
Stderr io.Writer
}
var (
@@ -63,12 +62,5 @@ func RunCommand(opts *RunCommandOptions) error {
if err = r.Reset(); err != nil {
return err
}
if err = r.Run(p); err != nil {
if opts.IgnoreErrorCode {
if _, ok := err.(interp.ExitCode); ok {
return nil
}
}
}
return err
return r.Run(p)
}