summaryrefslogtreecommitdiff
path: root/vendor/github.com/mattn/go-shellwords/shellwords.go
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2019-10-01 22:15:58 +0200
committerMiloslav Trmač <mitr@redhat.com>2019-10-04 20:18:23 +0200
commitd3f59bedb393521986e645bc48c47938f321b643 (patch)
treec61aa40e008b7fcb371d899880a4afd1714f50af /vendor/github.com/mattn/go-shellwords/shellwords.go
parentbd08fc0e9b3a9943008585879877b68789e38c31 (diff)
downloadpodman-d3f59bedb393521986e645bc48c47938f321b643.tar.gz
podman-d3f59bedb393521986e645bc48c47938f321b643.tar.bz2
podman-d3f59bedb393521986e645bc48c47938f321b643.zip
Update c/image to v4.0.1 and buildah to 1.11.3
This requires updating all import paths throughout, and a matching buildah update to interoperate. I can't figure out the reason for go.mod tracking github.com/containers/image v3.0.2+incompatible // indirect ((go mod graph) lists it as a direct dependency of libpod, but (go list -json -m all) lists it as an indirect dependency), but at least looking at the vendor subdirectory, it doesn't seem to be actually used in the built binaries. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Diffstat (limited to 'vendor/github.com/mattn/go-shellwords/shellwords.go')
-rw-r--r--vendor/github.com/mattn/go-shellwords/shellwords.go16
1 files changed, 7 insertions, 9 deletions
diff --git a/vendor/github.com/mattn/go-shellwords/shellwords.go b/vendor/github.com/mattn/go-shellwords/shellwords.go
index 41429d8f2..2dca7f136 100644
--- a/vendor/github.com/mattn/go-shellwords/shellwords.go
+++ b/vendor/github.com/mattn/go-shellwords/shellwords.go
@@ -40,6 +40,7 @@ type Parser struct {
ParseEnv bool
ParseBacktick bool
Position int
+ Dir string
// If ParseEnv is true, use this for getenv.
// If nil, use os.Getenv.
@@ -51,6 +52,7 @@ func NewParser() *Parser {
ParseEnv: ParseEnv,
ParseBacktick: ParseBacktick,
Position: 0,
+ Dir: "",
}
}
@@ -100,11 +102,11 @@ loop:
if !singleQuoted && !doubleQuoted && !dollarQuote {
if p.ParseBacktick {
if backQuote {
- out, err := shellRun(backtick)
+ out, err := shellRun(backtick, p.Dir)
if err != nil {
return nil, err
}
- buf = out
+ buf = buf[:len(buf)-len(backtick)] + out
}
backtick = ""
backQuote = !backQuote
@@ -117,15 +119,11 @@ loop:
if !singleQuoted && !doubleQuoted && !backQuote {
if p.ParseBacktick {
if dollarQuote {
- out, err := shellRun(backtick)
+ out, err := shellRun(backtick, p.Dir)
if err != nil {
return nil, err
}
- if r == ')' {
- buf = buf[:len(buf)-len(backtick)-2] + out
- } else {
- buf = buf[:len(buf)-len(backtick)-1] + out
- }
+ buf = buf[:len(buf)-len(backtick)-2] + out
}
backtick = ""
dollarQuote = !dollarQuote
@@ -155,7 +153,7 @@ loop:
continue
}
case ';', '&', '|', '<', '>':
- if !(escaped || singleQuoted || doubleQuoted || backQuote) {
+ if !(escaped || singleQuoted || doubleQuoted || backQuote || dollarQuote) {
if r == '>' && len(buf) > 0 {
if c := buf[0]; '0' <= c && c <= '9' {
i -= 1