workaround to get adequate window size on Windows Terminal

This commit is contained in:
Lincoln Stein 2023-06-04 23:44:07 -04:00
parent 117536324c
commit 090b7eeaf3

View File

@ -24,7 +24,16 @@ def set_terminal_size(columns: int, lines: int):
OS = platform.uname().system
if OS == "Windows":
_set_terminal_size_powershell(width,height)
# The new Windows Terminal doesn't resize, so we relaunch in a CMD window.
# Would prefer to use execvpe() here, but somehow it is not working properly
# in the Windows 10 environment.
if 'WT_SESSION' in os.environ:
args=['conhost']
args.extend(sys.argv)
os.environ.pop('WT_SESSION')
os.execvp('conhost',args)
else:
_set_terminal_size_powershell(width,height)
elif OS in ["Darwin", "Linux"]:
_set_terminal_size_unix(width,height)