Skip to content

Commit 3907c9a

Browse files
authored
Merge pull request #41 from hnw/support-escaped-string-only-arguments
Support arguments consisting only of escaped string
2 parents 412745d + 8b3b118 commit 3907c9a

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

shellwords.go

+1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ loop:
7272
if escaped {
7373
buf += string(r)
7474
escaped = false
75+
got = true
7576
continue
7677
}
7778

shellwords_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ var testcases = []struct {
3434
{`a ' '`, []string{`a`, ` `}},
3535
{"foo bar\\ ", []string{`foo`, `bar `}},
3636
{`foo "" bar ''`, []string{`foo`, ``, `bar`, ``}},
37+
{`foo \\`, []string{`foo`, `\`}},
38+
{`foo \& bar`, []string{`foo`, `&`, `bar`}},
3739
}
3840

3941
func TestSimple(t *testing.T) {

0 commit comments

Comments
 (0)