1
0
mirror of https://github.com/go-task/task.git synced 2025-11-27 22:38:20 +02:00

Upgrade mvdan.cc/sh to v3.0.0-beta1

This commit is contained in:
Andrey Nering
2019-11-24 19:17:09 -03:00
parent fea23ed6d4
commit 09d5d802d0
4 changed files with 36 additions and 17 deletions

View File

@@ -49,7 +49,12 @@ func RunCommand(ctx context.Context, opts *RunCommandOptions) error {
interp.Dir(opts.Dir),
interp.Env(expand.ListEnviron(environ...)),
interp.WithOpenModules(interp.OpenDevImpls),
interp.OpenHandler(func(ctx context.Context, path string, flag int, perm os.FileMode) (io.ReadWriteCloser, error) {
if path == "/dev/null" {
return devNull{}, nil
}
return interp.DefaultOpenHandler()(ctx, path, flag, perm)
}),
interp.StdIO(opts.Stdin, opts.Stdout, opts.Stderr),
)
@@ -61,12 +66,10 @@ func RunCommand(ctx context.Context, opts *RunCommandOptions) error {
// IsExitError returns true the given error is an exis status error
func IsExitError(err error) bool {
switch err.(type) {
case interp.ExitStatus:
if _, ok := interp.IsExitStatus(err); ok {
return true
default:
return false
}
return false
}
// Expand is a helper to mvdan.cc/shell.Fields that returns the first field