Bugfix: always check for newline after matched pattern.
Showing
1 changed file
with
6 additions
and
4 deletions
... | @@ -152,8 +152,9 @@ proc mu_exec {args} { | ... | @@ -152,8 +152,9 @@ proc mu_exec {args} { |
152 | for {set i 0} {$i < [llength $args]} {incr i} { | 152 | for {set i 0} {$i < [llength $args]} {incr i} { |
153 | set opt [lindex $args $i] | 153 | set opt [lindex $args $i] |
154 | if {"$opt" == "-retcode"} { | 154 | if {"$opt" == "-retcode"} { |
155 | set retcode [lindex $args [expr $i + 1]] | ||
156 | incr i | 155 | incr i |
156 | set retcode [lindex $args $i] | ||
157 | verbose "RETCODE $retcode" 1 | ||
157 | } elseif {"$opt" == "-message"} { | 158 | } elseif {"$opt" == "-message"} { |
158 | set message [lindex $args [expr $i + 1]] | 159 | set message [lindex $args [expr $i + 1]] |
159 | incr i | 160 | incr i |
... | @@ -197,7 +198,7 @@ proc mu_exec {args} { | ... | @@ -197,7 +198,7 @@ proc mu_exec {args} { |
197 | 198 | ||
198 | set res [remote_exec host $cmd] | 199 | set res [remote_exec host $cmd] |
199 | 200 | ||
200 | set args [concat $args "$retcode"] | 201 | lappend args "$retcode" |
201 | 202 | ||
202 | set output [lindex $res 1] | 203 | set output [lindex $res 1] |
203 | 204 | ||
... | @@ -226,7 +227,7 @@ proc mu_exec {args} { | ... | @@ -226,7 +227,7 @@ proc mu_exec {args} { |
226 | 227 | ||
227 | if {$regexp} { | 228 | if {$regexp} { |
228 | verbose "does \"$output\" match regular expression \"$pattern\"?" 1 | 229 | verbose "does \"$output\" match regular expression \"$pattern\"?" 1 |
229 | if {![regexp -- "$pattern(.*)" "$output" dummy output]} { | 230 | if {![regexp -- "${pattern}(.*)" "$output" dummy output]} { |
230 | set result 1 | 231 | set result 1 |
231 | } | 232 | } |
232 | } else { | 233 | } else { |
... | @@ -237,10 +238,11 @@ proc mu_exec {args} { | ... | @@ -237,10 +238,11 @@ proc mu_exec {args} { |
237 | } | 238 | } |
238 | set output [string range $output [string length $pattern] end] | 239 | set output [string range $output [string length $pattern] end] |
239 | } | 240 | } |
241 | } | ||
242 | |||
240 | if {![regexp -- "\[ \t]*\r\n(.*)" "$output" dummy output]} { | 243 | if {![regexp -- "\[ \t]*\r\n(.*)" "$output" dummy output]} { |
241 | set result 1 | 244 | set result 1 |
242 | } | 245 | } |
243 | } | ||
244 | 246 | ||
245 | if {$result} { | 247 | if {$result} { |
246 | verbose "NO" 1 | 248 | verbose "NO" 1 | ... | ... |
-
Please register or sign in to post a comment