mirror of
https://github.com/go-task/task.git
synced 2025-11-23 22:24:45 +02:00
Fix failing test
There was some breaking changes described at https://github.com/mvdan/sh/issues/335#issuecomment-447605295
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
|
||||
"mvdan.cc/sh/expand"
|
||||
"mvdan.cc/sh/interp"
|
||||
"mvdan.cc/sh/shell"
|
||||
"mvdan.cc/sh/syntax"
|
||||
)
|
||||
|
||||
@@ -67,3 +68,16 @@ func IsExitError(err error) bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// Expand is a helper to mvdan.cc/shell.Fields that returns the first field
|
||||
// if available.
|
||||
func Expand(s string) (string, error) {
|
||||
fields, err := shell.Fields(s, nil)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if len(fields) > 0 {
|
||||
return fields[0], nil
|
||||
}
|
||||
return "", nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user