[Git][NTPsec/ntpsec][master] BSD systems have stty labels after the numbers instead of before

Eric S. Raymond gitlab at mg.gitlab.com
Mon Oct 31 15:36:21 UTC 2016


Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
4f4a084d by Matt Selsky at 2016-10-31T08:27:50-04:00
BSD systems have stty labels after the numbers instead of before

- - - - -


1 changed file:

- pylib/util.py


Changes:

=====================================
pylib/util.py
=====================================
--- a/pylib/util.py
+++ b/pylib/util.py
@@ -43,11 +43,11 @@ def termsize():
         output = subprocess.check_output(shlex.split('/bin/stty -a'))
     except OSError:
         return (24, 80)
-    m = re.search('rows\D+(\d+); columns\D+(\d+);', output)
-    if m:
-        return int(m.group(1)), int(m.group(2))
-    else:
-        return (24, 80)
+    for pattern in ('rows\D+(\d+); columns\D+(\d+);', '\s+(\d+)\D+rows;\s+(\d+)\D+columns;'):
+        m = re.search(pattern, output)
+        if m:
+            return int(m.group(1)), int(m.group(2))
+    return (24, 80)
 
 class PeerSummary:
     "Reusable report generator for peer statistics"



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/4f4a084d718ce8cd2dd00a39e79e24ea115928c4
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20161031/9a07408d/attachment.html>


More information about the vc mailing list