1

我正在尝试通过线程处理生成过程,但它抛出错误“无效命令”。但没有线程它工作正常。

set listner [thread::create {
package require Expect
proc router_config {s filename} {
set command_router "{Password: } {abc@123\r}
                    {Router>} {en\r}
                    {Password: } {abc@123\r}"
 spawn telnet 1.1.1.1 
foreach {exp_prompt send_cmd} $command_router {
    expect "$exp_prompt"
    exp_send "$send_cmd"
}
return 1
}
[thread::wait]
}]
set commandString "xyz"
eval [subst {thread::send -async $listner \
    {router_config 0 [list $commandString ]}}]

puts "--------->> releasing thread [thread::id] [thread::release]"

exit 0

请提出一些处理方法。

4

0 回答 0