[Git][NTPsec/ntpsec][master] Python3: make sure stty -a is returned as a str, instead of bytes

Eric S. Raymond gitlab at mg.gitlab.com
Sun Nov 27 09:38:53 UTC 2016


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


Commits:
1c7af70b by Matt Selsky at 2016-11-27T00:09:50-05:00
Python3: make sure stty -a is returned as a str, instead of bytes

Fixes GitLab issue #166

- - - - -


1 changed file:

- pylib/util.py


Changes:

=====================================
pylib/util.py
=====================================
--- a/pylib/util.py
+++ b/pylib/util.py
@@ -65,7 +65,7 @@ def termsize():
     # Alternatives at http://stackoverflow.com/questions/566746/how-to-get-console-window-width-in-python
     import shlex, subprocess, re
     try:
-        output = subprocess.check_output(shlex.split('/bin/stty -a'))
+        output = subprocess.check_output(shlex.split('/bin/stty -a'), universal_newlines=True)
     except (OSError, subprocess.CalledProcessError, AttributeError):
         return (24, 80)
     for pattern in ('rows\D+(\d+); columns\D+(\d+);', '\s+(\d+)\D+rows;\s+(\d+)\D+columns;'):



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/1c7af70bad933803ec1ad83b2d6b2589283355d3
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20161127/20cd3553/attachment.html>


More information about the vc mailing list