浏览代码

[F] Fix terminal stuck in raw mode

https://github.com/hykilpikonna/hyfetch/issues/41
Hykilpikonna 2 年之前
父节点
当前提交
5b9271e7e5
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      hyfetch/termenv.py

+ 2 - 0
hyfetch/termenv.py

@@ -116,6 +116,8 @@ def unix_read_osc(seq: int) -> str:
 
     # Wait for input to appear
     if not select([sys.stdin], [], [], timeout)[0]:
+        # Reset terminal back to normal mode (previously set to raw mode)
+        termios.tcsetattr(fd, termios.TCSADRAIN, settings)
         raise OSCException("No response received")
 
     # Read until termination, or if it doesn't terminate, read until 1 second passes