Browse Source

term.py: `register_cleanup()` fix

The MMGen Project 2 years ago
parent
commit
e52588b5af
1 changed files with 16 additions and 8 deletions
  1. 16 8
      mmgen/term.py

+ 16 - 8
mmgen/term.py

@@ -47,14 +47,7 @@ class MMGenTerm(object):
 
 	@classmethod
 	def register_cleanup(cls):
-		if gc.platform == 'linux' and not hasattr(cls,'cleanup_registered'):
-			import atexit
-			atexit.register(
-				lambda: termios.tcsetattr(
-					cls.stdin_fd,
-					termios.TCSADRAIN,
-					cls.orig_term) )
-			cls.cleanup_registered = True
+		pass
 
 	@classmethod
 	def init(cls,noecho=False):
@@ -74,6 +67,17 @@ class MMGenTerm(object):
 
 class MMGenTermLinux(MMGenTerm):
 
+	@classmethod
+	def register_cleanup(cls):
+		if not hasattr(cls,'cleanup_registered'):
+			import atexit
+			atexit.register(
+				lambda: termios.tcsetattr(
+					cls.stdin_fd,
+					termios.TCSADRAIN,
+					cls.orig_term) )
+			cls.cleanup_registered = True
+
 	@classmethod
 	def reset(cls):
 		termios.tcsetattr( cls.stdin_fd, termios.TCSANOW, cls.orig_term )
@@ -159,6 +163,10 @@ class MMGenTermLinux(MMGenTerm):
 
 class MMGenTermLinuxStub(MMGenTermLinux):
 
+	@classmethod
+	def register_cleanup(cls):
+		pass
+
 	@classmethod
 	def init(cls,noecho=False):
 		cls.stdin_fd = sys.stdin.fileno()