diff options
author | Thomas Kluyver <takowl@gmail.com> | 2013-09-18 11:08:05 -0700 |
---|---|---|
committer | Thomas Kluyver <takowl@gmail.com> | 2013-09-18 11:08:05 -0700 |
commit | 18ee3507e8a8f054b64cfe2bc433bb4b58b10b3e (patch) | |
tree | 74e92587e28be0984ff617cffb22a7327811c706 /tests/sigwinch_report.py | |
parent | 608a07766363a664d710d49141f6ba1baa3e7213 (diff) | |
download | pexpect-git-18ee3507e8a8f054b64cfe2bc433bb4b58b10b3e.tar.gz |
Python 3 support in test_winsize
Diffstat (limited to 'tests/sigwinch_report.py')
-rwxr-xr-x | tests/sigwinch_report.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/sigwinch_report.py b/tests/sigwinch_report.py index 26030cb..b9b4ff1 100755 --- a/tests/sigwinch_report.py +++ b/tests/sigwinch_report.py @@ -17,7 +17,9 @@ PEXPECT LICENSE OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ''' -import signal, time, struct, fcntl, termios, os, sys +from __future__ import print_function + +import signal, time, struct, fcntl, termios, sys def getwinsize(): '''This returns the window size of the child tty. @@ -26,18 +28,18 @@ def getwinsize(): if 'TIOCGWINSZ' in dir(termios): TIOCGWINSZ = termios.TIOCGWINSZ else: - TIOCGWINSZ = 1074295912L # Assume + TIOCGWINSZ = 1074295912 # Assume s = struct.pack('HHHH', 0, 0, 0, 0) x = fcntl.ioctl(sys.stdout.fileno(), TIOCGWINSZ, s) return struct.unpack('HHHH', x)[0:2] def handler(signum, frame): - print 'signal' + print('signal') sys.stdout.flush() - print 'SIGWINCH:', getwinsize () + print('SIGWINCH:', getwinsize ()) sys.stdout.flush() -print "setting handler for SIGWINCH" +print("setting handler for SIGWINCH") signal.signal(signal.SIGWINCH, handler) while 1: |