Commit 685c021d 685c021ddafe60746790565b18d041a93263df42 by Sergey Poznyakoff

Expect the prompt to appear after the last pattern

1 parent eecbee85
...@@ -124,7 +124,6 @@ verbose "MAILRC is $srcdir/etc/mail.rc" 2 ...@@ -124,7 +124,6 @@ verbose "MAILRC is $srcdir/etc/mail.rc" 2
124 return 1 124 return 1
125 } 125 }
126 } 126 }
127 mail_send "#\n"
128 return 0 127 return 0
129 } 128 }
130 129
...@@ -154,14 +153,6 @@ proc mail_send { string } { ...@@ -154,14 +153,6 @@ proc mail_send { string } {
154 } 153 }
155 154
156 proc mail_command { cmd } { 155 proc mail_command { cmd } {
157 global mail_prompt
158 mail_expect 30 {
159 -re "\[\r\n\]?${mail_prompt}$" {}
160 default {
161 perror "mail not initialized"
162 return 1
163 }
164 }
165 set res [mail_send "$cmd\n"] 156 set res [mail_send "$cmd\n"]
166 mail_expect 30 { 157 mail_expect 30 {
167 -ex "${cmd}\r\n" { } 158 -ex "${cmd}\r\n" { }
...@@ -267,7 +258,8 @@ proc mail_expect { args } { ...@@ -267,7 +258,8 @@ proc mail_expect { args } {
267 proc default_mail_test { args } { 258 proc default_mail_test { args } {
268 global verbose 259 global verbose
269 global mail_prompt 260 global mail_prompt
270 global suppress_flag; 261 global suppress_flag
262 global mail_prompt
271 upvar timeout timeout 263 upvar timeout timeout
272 264
273 set command [lindex $args 0] 265 set command [lindex $args 0]
...@@ -330,6 +322,14 @@ proc default_mail_test { args } { ...@@ -330,6 +322,14 @@ proc default_mail_test { args } {
330 } 322 }
331 } 323 }
332 } 324 }
325
326 mail_expect 30 {
327 -re "\[\r\n\]?${mail_prompt}$" {}
328 default {
329 perror "mail not initialized"
330 return 1
331 }
332 }
333 return $result 333 return $result
334 } 334 }
335 335
......