Posted to tcl by schelte at Wed May 10 18:13:32 GMT 2023view raw
- foreach host $hosts {
- set pipe [open |[list ping -c 1 $host]]
- chan configure $pipe -blocking 0
- chan event $pipe readable [list receive $pipe $host]
- }
- proc receive {fd host} {
- if {[eof $fd]} {
- chan configure $fd -blocking 1
- if {[catch {close $fd} err info]} {
- puts [dict get $info -errorCode]
- }
- } elseif {[gets $fd line] >= 0} {
- puts "$host: $line"
- }
- }
Comments
Posted by schelte at Wed May 10 18:20:10 GMT 2023 [text] [code]
Should be "puts [dict get $info -errorcode]" (lowercase c).