Skip to content

Commit

Permalink
exclude colon in tcl conf parse (OpenAtomFoundation#1768)
Browse files Browse the repository at this point in the history
Co-authored-by: J1senn <[email protected]>
  • Loading branch information
A2ureStone and J1senn authored Jul 20, 2023
1 parent 351018d commit ad82ca3
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions tests/support/server.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ proc start_server {options {code undefined}} {
if {[string length $line] > 0 && [string index $line 0] ne "#"} {
set elements [split $line " "]
set directive [lrange $elements 0 0]
set arguments [lrange $elements 1 end]
set arguments [lrange $elements 2 end]
dict set config $directive $arguments
}
}
Expand All @@ -198,10 +198,7 @@ proc start_server {options {code undefined}} {
set config_file [tmpfile redis.conf]
set fp [open $config_file w+]
foreach directive [dict keys $config] {
if {$directive == "port"} {
puts -nonewline $fp "$directive : "
puts $fp [dict get $config $directive]
} elseif {$directive == "requirepass" || $directive == "userpass"} {
if {$directive == "requirepass" || $directive == "userpass"} {
if {[dict get $config $directive] eq ":"} {
puts $fp "$directive: "
} else {
Expand All @@ -210,7 +207,7 @@ proc start_server {options {code undefined}} {
} elseif {$directive == "dump_prefix"} {
puts $fp "$directive :"
} else {
puts -nonewline $fp "$directive "
puts -nonewline $fp "$directive : "
puts $fp [dict get $config $directive]
}
}
Expand Down

0 comments on commit ad82ca3

Please sign in to comment.