From 241d32c3a03c0004ff163d3cacdcbcc6cf7820d2 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Thu, 14 Jun 2012 03:00:33 +0100 Subject: [PATCH] tiocnotty: use with statement --- tiocnotty | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tiocnotty b/tiocnotty index 694c62d..1324d3a 100755 --- a/tiocnotty +++ b/tiocnotty @@ -6,9 +6,8 @@ import sys import termios try: - tty = open('/dev/tty') - fcntl.ioctl(tty, termios.TIOCNOTTY) - tty.close() + with open('/dev/tty') as tty: + fcntl.ioctl(tty, termios.TIOCNOTTY) except IOError: pass -- 2.30.2