Artifact
0cf90df8e130ffd6c101178719f202179ed05fea:
Attachment "chan.tcl" to
ticket [2826248fff]
added by
andy22286
2009-07-24 05:17:13.
#!/bin/sh
# exec magic \
exec tclsh8.6 "$0" ${1+"$@"}
namespace eval chan {
namespace ensemble create -command prefix -map {
initialize {::apply {{channelId mode} {
if {$mode ne {write}} {
error "$mode mode not supported"
}
return {initialize finalize watch write}
}}}
finalize {::apply {{channelId} {
}}}
watch {::apply {{channelId eventSpec} {
}}}
write {::apply {{channelId data} {
puts $data
return [string length $data]
}}}
}
}
set c [chan create {write} chan::prefix]
exec echo hello >@ $c