【发布时间】:2021-09-09 07:10:30
【问题描述】:
问题是link 中回答的内容的扩展。在尝试使用它延迟打印输出时,shell 上的cat file_name 不会在使用after 的延迟时间内显示文件的内容。代码如下:
proc foo {times} {
while {$times >0} {
puts "hello$times"
incr times -1
after 20000
puts "hello world"
}
}
proc reopenStdout {file} {
close stdout
open $file w ;# The standard channels are special
}
reopenStdout ./bar
foo 10
【问题讨论】: