Commit 42d4fece 42d4fece15cdb99a7952a1889ebbe2628a518639 by Sergey Poznyakoff

Bugfix: always check for newline after matched pattern.

1 parent ba257933
...@@ -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,9 +238,10 @@ proc mu_exec {args} { ...@@ -237,9 +238,10 @@ 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 }
240 if {![regexp -- "\[ \t]*\r\n(.*)" "$output" dummy output]} { 241 }
241 set result 1 242
242 } 243 if {![regexp -- "\[ \t]*\r\n(.*)" "$output" dummy output]} {
244 set result 1
243 } 245 }
244 246
245 if {$result} { 247 if {$result} {
......