chiark / gitweb /
bsmtp-pull: drop -2; avoid connection sharing
[bin.git] / tiocnotty
index 694c62ddfe45ef79993a305610021e9dbc3484d1..715f8ee5a4905ee3804c3f290fff9d65954a4a9b 100755 (executable)
--- a/tiocnotty
+++ b/tiocnotty
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#! /usr/bin/python3
 
 import fcntl
 import os
@@ -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