Support for windows: getting terminal width and height without using 'fcntl'
hedyhli opened this issue · 1 comments
hedyhli commented
When running starcli on windows it throws the following error, because fcntl
is not supported on windows:
Traceback (most recent call last):
File "c:\program files\python38\lib\runpy.py", line 192, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\program files\python38\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\<username>\AppData\Roaming\Python\Python38\Scripts\starcli.exe\__main__.py", line 9, in <module>
File "C:\Users\<username>\AppData\Roaming\Python\Python38\site-packages\starcli\__main__.py", line 39, in cli
list_layout(repos)
File "C:\Users\<username>\AppData\Roaming\Python\Python38\site-packages\starcli\layouts.py", line 18, in list_layout
term_width, _ = terminal_size()
File "C:\Users\<username>\AppData\Roaming\Python\Python38\site-packages\starcli\terminal_size.py", line 6, in terminal_size
import fcntl, termios, struct
ModuleNotFoundError: No module named 'fcntl'
In order to support windows, we need an alternative way (or extra way if the os is windows) to fetch the terminal width and height to be used in list layout printing. In other words, finding a substitute to fcntl
to fetch terminal size info.