Help language development. Donate to The Perl Foundation
Terminal::Size - raku programming language library to get a tty size Works on Linux, MacOS* and BSD*
#!/usr/bin/raku use Terminal::Size; my winsize $size = terminal-size(); my uint16 $rows = $size.rows; # 76 my uint16 $cols = $size.cols; # 310
#!/usr/bin/raku use Terminal::Size; my $fd = "somefile.tty".IO.open: :r; my $size = terminal-size($fd); if !$size { # Failure note "Failed " ~ $size.exception.message; exit 1; } my uint16 $rows = $size.rows; # 76 my uint16 $cols = $size.cols; # 310
ioctl $FD TIOCGWINSZ *winsize