Skip to content

Commit 8b3b118

Browse files
committed
Support arguments consisting only of escaped string
1 parent 28e4fdf commit 8b3b118

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
@@ -70,6 +70,7 @@ loop:
7070
if escaped {
7171
buf += string(r)
7272
escaped = false
73+
got = true
7374
continue
7475
}
7576

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)