beetlebug▾
/

ztcl::pty size

Gives the size of the terminal.

ztcl::pty size CHANNEL

Description

Gives the list COLS ROWS: the size of the terminal from the kernel on Linux and macOS, and the last size of spawn or resize on Windows.

Arguments

ArgumentTypeDefaultDescription
CHANNELchannelrequiredA channel of spawn.

Returns

A list of two integers.

Examples

Each example of this page runs after # The shell of the platform: in host mode the separator of Windows is a backslash. set sh [expr {[file separator] eq "/" ? "/bin/sh" : "cmd.exe"}] # Reads the output with no block until the program ends, and gives its status. proc finish {t} { fconfigure $t -blocking 0 for {set n 0} {[ztcl::pty status $t] eq "running" && $n < 1000} {incr n} { read $t; after 10 } ztcl::pty status $t } .

% set t [ztcl::pty spawn $sh]
> set r [ztcl::pty size $t]
> close $t
> set r
80 24

Errors

% ztcl::pty size stdout
channel "stdout" is not a pty
-errorcode NONE

% ztcl::pty size nochan
can not find channel named "nochan"
-errorcode TCL LOOKUP CHANNEL nochan

% ztcl::pty size
wrong # args: should be "ztcl::pty size channel"
-errorcode TCL WRONGARGS

Facts

Capability
exec. A new interpreter does not have it until the host turns it on.
Tcl release
Tcl 9.1 and 8.6.
Since
ztcl 1.0.0-beta.1

See also