mirror of
https://github.com/tiny-craft/tiny-rdm.git
synced 2025-04-22 13:28:05 +08:00
fix: parse command error (#231)
This commit is contained in:
parent
fc0deac074
commit
33caf873d6
@ -137,7 +137,7 @@ func SplitCmd(cmd string) []string {
|
||||
var preChar int32
|
||||
inQuotes := false
|
||||
|
||||
for _, char := range cmd {
|
||||
for _, char := range []rune(cmd) {
|
||||
if char == '"' && preChar != '\\' {
|
||||
inQuotes = !inQuotes
|
||||
} else if char == ' ' && !inQuotes {
|
||||
@ -148,7 +148,7 @@ func SplitCmd(cmd string) []string {
|
||||
curStr.Reset()
|
||||
}
|
||||
} else {
|
||||
curStr.WriteByte(byte(char))
|
||||
curStr.WriteRune(char)
|
||||
}
|
||||
preChar = char
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user