Skip to content

Commit 8d4384d

Browse files
committed
move termios import for windows
1 parent b7a8daf commit 8d4384d

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

gdbgui/ptylib.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import pty
22
import select
33
import struct
4-
import termios
54
import signal
65
from typing import Optional
76
import os
87
import shlex
98

109
USING_WINDOWS = os.name == "nt"
1110
if not USING_WINDOWS:
11+
import termios
1212
import fcntl
1313

1414

@@ -45,6 +45,9 @@ def sigint_handler(sig, frame):
4545
self.set_echo(echo)
4646

4747
def set_echo(self, echo_on: bool) -> None:
48+
if USING_WINDOWS:
49+
# TODO
50+
return
4851
(iflag, oflag, cflag, lflag, ispeed, ospeed, cc) = termios.tcgetattr(self.stdin)
4952
if echo_on:
5053
lflag = lflag & termios.ECHO # type: ignore
@@ -57,16 +60,15 @@ def set_echo(self, echo_on: bool) -> None:
5760
)
5861

5962
def set_winsize(self, rows: int, cols: int):
63+
if USING_WINDOWS:
64+
# TODO set window size
65+
return
6066
xpix = 0
6167
ypix = 0
6268
winsize = struct.pack("HHHH", rows, cols, xpix, ypix)
6369
if self.stdin is None:
6470
raise RuntimeError("fd stdin not assigned")
65-
if USING_WINDOWS:
66-
# TODO set window size
67-
pass
68-
else:
69-
fcntl.ioctl(self.stdin, termios.TIOCSWINSZ, winsize)
71+
fcntl.ioctl(self.stdin, termios.TIOCSWINSZ, winsize)
7072

7173
def read(self) -> Optional[str]:
7274
if self.stdout is None:

0 commit comments

Comments
 (0)