set cmd1 [open "| command_name" r+]
fconfigure $cmd1 -blocking 0
fileevent $cmd1 readable "readMe $cmd1"
可以修改成以下的設定後再試看看
set cmd1 [open "| command_name |& cat"]
fconfigure $cmd1 -blocking 0
fileevent $cmd1 readable "readMe $cmd1"
搭配的readMe也要小修一下
proc ::readMe {chan} {
if {[gets $chan line] < 0} {
if {[eof $chan]} {
close $chan
set ::done ok
}
} else {
::tkcon::EvalSlave puts $line
}
}
if {[gets $chan line] < 0} {
if {[eof $chan]} {
close $chan
set ::done ok
}
} else {
::tkcon::EvalSlave puts $line
}
}
沒有留言:
張貼留言