Skip to content

Unable to get Terminal Size error #43

@scottchiefbaker

Description

@scottchiefbaker

I'm getting this error when in Dump::Krumo:

Unable to get Terminal Size. The TIOCGWINSZ ioctl didn't work. The COLUMNS and LINES environment variables didn't work. The resize program didn't work. The stty program didn't work. at /home/bakers/perl5/lib/perl5/Dump/Krumo.pm line 738.

I'm guessing for some reason there is not TTY attached and this is TRK's way of saying that? I'm trying to work around this by falling back to tput

sub get_terminal_width {
    my @x;
    my $width;
    my $ok = 0;

    eval {
        @x  = Term::ReadKey::GetTerminalSize();
        $ok = 1;
    };
    my $err_msg = $@;

    # If there was an error with the eval fallback to tput
    if ($ok) {
        $width = $x[0];
    } else {
        $width = `tput cols`;
    }

    $width = int($width);

    return $width;
}

I'm still getting this error, even with the code inside of an eval. Can you shed any light on where I should troubleshoot next?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions