#fallback - try external executable. Which is a bit ugly
#fallback - try external executable. Which is a bit ugly
#tput can work on windows too if it's installed e.g from msys2
#tput can't seem to get dimensions (on FreeBSD at least) when not run interactively - ie via exec. (always returns 80x24 no matter if run with <@stdin)
#bizarrely - tput can work with exec on windows if it's installed e.g from msys2
#but can be *slow* compared to unix e.g 400ms+ vs <2ms on FreeBSD !
#but can be *slow* compared to unix e.g 400ms+ vs <2ms on FreeBSD !
#stty -a is 400ms+ vs 500us+ on FreeBSD
if {"windows" eq $::tcl_platform(platform)} {
set tputcmd [auto_execok tput]
set tputcmd [auto_execok tput]
if {$tputcmd ne ""} {
if {$tputcmd ne ""} {
if {![catch {exec {*}$tputcmd cols lines} values]} {
if {![catch {exec {*}$tputcmd cols lines} values]} {