Don't try to get the window size if it was never set before.

Fixes the test failure on Solaris.
This commit is contained in:
Martin v. Löwis 2008-05-24 09:36:45 +00:00
parent 68faf5b0fc
commit 7d3d04d6db
1 changed files with 0 additions and 3 deletions

View File

@ -52,13 +52,10 @@ class IoctlTests(unittest.TestCase):
set_winsz_opcode_maybe_neg, = struct.unpack("i", set_winsz_opcode_maybe_neg, = struct.unpack("i",
struct.pack("I", termios.TIOCSWINSZ)) struct.pack("I", termios.TIOCSWINSZ))
# We're just testing that these calls do not raise exceptions.
saved_winsz = fcntl.ioctl(mfd, termios.TIOCGWINSZ, "\0"*8)
our_winsz = struct.pack("HHHH",80,25,0,0) our_winsz = struct.pack("HHHH",80,25,0,0)
# test both with a positive and potentially negative ioctl code # test both with a positive and potentially negative ioctl code
new_winsz = fcntl.ioctl(mfd, set_winsz_opcode_pos, our_winsz) new_winsz = fcntl.ioctl(mfd, set_winsz_opcode_pos, our_winsz)
new_winsz = fcntl.ioctl(mfd, set_winsz_opcode_maybe_neg, our_winsz) new_winsz = fcntl.ioctl(mfd, set_winsz_opcode_maybe_neg, our_winsz)
fcntl.ioctl(mfd, set_winsz_opcode_maybe_neg, saved_winsz)
finally: finally:
os.close(mfd) os.close(mfd)
os.close(sfd) os.close(sfd)