We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 230d3f7 commit 85baf17Copy full SHA for 85baf17
backend/utils/string/any_convert.go
@@ -137,7 +137,7 @@ func SplitCmd(cmd string) []string {
137
var preChar int32
138
var quotesChar int32
139
140
- cmdRune := []rune(cmd)
+ cmdRune := []rune(strings.TrimSpace(cmd))
141
for _, char := range cmdRune {
142
if (char == '"' || char == '\'') && preChar != '\\' && (quotesChar == 0 || quotesChar == char) {
143
if quotesChar != 0 {
@@ -157,7 +157,7 @@ func SplitCmd(cmd string) []string {
157
158
result = sliceutil.FilterMap(result, func(i int) (string, bool) {
159
var part = strings.TrimSpace(result[i])
160
- if len(part) <= 0 {
+ if i == 0 && len(part) <= 0 {
161
return "", false
162
}
163
if strings.Contains(part, "\\") {
0 commit comments