Skip to content

Commit 2948868

Browse files
committed
Fixed tests on Windows
1 parent f726f63 commit 2948868

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

domdf_python_tools/terminal.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#
88
# Copyright © 2014-2020 Dominic Davis-Foster <[email protected]>
99
#
10-
# get_terminal_size, _get_terminal_size_windows, _get_terminal_size_tput and _get_terminal_size_linux
10+
# get_terminal_size, _get_terminal_size_windows, _get_terminal_size_tput and _get_terminal_size_posix
1111
# from https://gist.github.com/jtriley/1108174
1212
# Copyright © 2011 jtriley
1313
#
@@ -60,7 +60,6 @@
6060
#
6161

6262
# stdlib
63-
import fcntl
6463
import inspect
6564
import os
6665
import platform
@@ -157,7 +156,7 @@ def get_terminal_size() -> Tuple[int, int]:
157156
# needed for window's python in cygwin's xterm!
158157

159158
if current_os in {"Linux", "Darwin"} or current_os.startswith("CYGWIN"):
160-
tuple_xy = _get_terminal_size_linux()
159+
tuple_xy = _get_terminal_size_posix()
161160

162161
if tuple_xy is None:
163162
print("default")
@@ -203,7 +202,8 @@ def _get_terminal_size_tput() -> Optional[Tuple[int, int]]:
203202
return None
204203

205204

206-
def _get_terminal_size_linux() -> Optional[Tuple[int, int]]:
205+
def _get_terminal_size_posix() -> Optional[Tuple[int, int]]:
206+
import fcntl
207207

208208
def ioctl_GWINSZ(fd):
209209
try:

0 commit comments

Comments
 (0)