diff options
Diffstat (limited to 'vendor/github.com/mattn')
-rw-r--r-- | vendor/github.com/mattn/go-shellwords/go.mod | 2 | ||||
-rw-r--r-- | vendor/github.com/mattn/go-shellwords/shellwords.go | 28 |
2 files changed, 24 insertions, 6 deletions
diff --git a/vendor/github.com/mattn/go-shellwords/go.mod b/vendor/github.com/mattn/go-shellwords/go.mod index 8d96dbd5f..927c8c7d6 100644 --- a/vendor/github.com/mattn/go-shellwords/go.mod +++ b/vendor/github.com/mattn/go-shellwords/go.mod @@ -1 +1,3 @@ module github.com/mattn/go-shellwords + +go 1.13 diff --git a/vendor/github.com/mattn/go-shellwords/shellwords.go b/vendor/github.com/mattn/go-shellwords/shellwords.go index ff5e73091..ef080861a 100644 --- a/vendor/github.com/mattn/go-shellwords/shellwords.go +++ b/vendor/github.com/mattn/go-shellwords/shellwords.go @@ -88,9 +88,17 @@ loop: backtick += string(r) } else if got { if p.ParseEnv { - buf = replaceEnv(p.Getenv, buf) + parser := &Parser{ParseEnv: false, ParseBacktick: false, Position: 0, Dir: p.Dir} + strs, err := parser.Parse(replaceEnv(p.Getenv, buf)) + if err != nil { + return nil, err + } + for _, str := range strs { + args = append(args, str) + } + } else { + args = append(args, buf) } - args = append(args, buf) buf = "" got = false } @@ -144,7 +152,7 @@ loop: } case '"': if !singleQuoted && !dollarQuote { - if doubleQuoted && buf == "" { + if doubleQuoted { got = true } doubleQuoted = !doubleQuoted @@ -152,7 +160,7 @@ loop: } case '\'': if !doubleQuoted && !dollarQuote { - if singleQuoted && buf == "" { + if singleQuoted { got = true } singleQuoted = !singleQuoted @@ -180,9 +188,17 @@ loop: if got { if p.ParseEnv { - buf = replaceEnv(p.Getenv, buf) + parser := &Parser{ParseEnv: false, ParseBacktick: false, Position: 0, Dir: p.Dir} + strs, err := parser.Parse(replaceEnv(p.Getenv, buf)) + if err != nil { + return nil, err + } + for _, str := range strs { + args = append(args, str) + } + } else { + args = append(args, buf) } - args = append(args, buf) } if escaped || singleQuoted || doubleQuoted || backQuote || dollarQuote { |