]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commitdiff
- Added a workaround for when we call ``fcntl.ioctl()`` to get at
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 2 Feb 2014 21:42:29 +0000 (16:42 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 2 Feb 2014 21:42:29 +0000 (16:42 -0500)
``TERMWIDTH``; if the function returns zero, as is reported to occur
in some pseudo-ttys, the message wrapping system is disabled in the
same way as if ``ioctl()`` failed. #172

alembic/util.py
docs/build/changelog.rst

index 49fea280eb0b630ae2cfdcf702d229fa7fa8a59b..015f732eeb5f8cff0f4254424f8e4f7731e24383 100644 (file)
@@ -40,6 +40,8 @@ try:
     ioctl = fcntl.ioctl(0, termios.TIOCGWINSZ,
                            struct.pack('HHHH', 0, 0, 0, 0))
     _h, TERMWIDTH, _hp, _wp = struct.unpack('HHHH', ioctl)
+    if TERMWIDTH <= 0:  # can occur if running in emacs pseudo-tty
+        TERMWIDTH = None
 except (ImportError, IOError):
     TERMWIDTH = None
 
index a3f7793e579216cb4c99c29ae19714868ce633f2..e78bad55828a776ff432830994f28f92b65b05b8 100644 (file)
@@ -5,6 +5,15 @@ Changelog
 .. changelog::
     :version: 0.6.3
 
+    .. change::
+      :tags: bug
+      :tickets: 172
+
+      Added a workaround for when we call ``fcntl.ioctl()`` to get at
+      ``TERMWIDTH``; if the function returns zero, as is reported to occur
+      in some pseudo-ttys, the message wrapping system is disabled in the
+      same way as if ``ioctl()`` failed.
+
     .. change::
       :tags: feature
       :tickets: 171