From: Mike Bayer Date: Sun, 2 Feb 2014 21:42:29 +0000 (-0500) Subject: - Added a workaround for when we call ``fcntl.ioctl()`` to get at X-Git-Tag: rel_0_6_3~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c1fcfae70f7bff5ea5642414e8293a520fcac618;p=thirdparty%2Fsqlalchemy%2Falembic.git - 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. #172 --- diff --git a/alembic/util.py b/alembic/util.py index 49fea280..015f732e 100644 --- a/alembic/util.py +++ b/alembic/util.py @@ -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 diff --git a/docs/build/changelog.rst b/docs/build/changelog.rst index a3f7793e..e78bad55 100644 --- a/docs/build/changelog.rst +++ b/docs/build/changelog.rst @@ -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