Move .setupterm() output so that we don't try to call endwin() if it fails

This commit is contained in:
Andrew M. Kuchling 2008-02-25 16:29:19 +00:00
parent c6b5200931
commit aa5e3cea7a
1 changed files with 3 additions and 4 deletions

View File

@ -269,13 +269,12 @@ if __name__ == '__main__':
curses.wrapper(main)
unit_tests()
else:
try:
# testing setupterm() inside initscr/endwin
# causes terminal breakage
curses.setupterm(fd=sys.__stdout__.fileno())
try:
stdscr = curses.initscr()
main(stdscr)
finally:
curses.endwin()
unit_tests()