protected function _detectNumberOfTerminalColumns() {
        $terminalCols = null;
        try {
            exec('tput cols 2> /dev/null', $terminalCols, $errorCode);

            if ($errorCode == 0 && $terminalCols && array_key_exists(0, $terminalCols)) {
                return (int)$terminalCols[0];
            }
        } catch (Exception $e) {
        }

        return self::DEFAULT_SCREEN_SIZE;
    }