Skip to content

Commit 6f2499a

Browse files
authored
only use console when available
1 parent 3dfed23 commit 6f2499a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Modules/posixmodule.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16865,12 +16865,16 @@ static PyObject *
1686516865
os__supports_virtual_terminal_impl(PyObject *module)
1686616866
/*[clinic end generated code: output=bd0556a6d9d99fe6 input=0752c98e5d321542]*/
1686716867
{
16868+
#ifdef HAVE_WINDOWS_CONSOLE_IO
1686816869
DWORD mode = 0;
1686916870
HANDLE handle = GetStdHandle(STD_ERROR_HANDLE);
1687016871
if (!GetConsoleMode(handle, &mode)) {
1687116872
Py_RETURN_FALSE;
1687216873
}
1687316874
return PyBool_FromLong(mode & ENABLE_VIRTUAL_TERMINAL_PROCESSING);
16875+
#else
16876+
Py_RETURN_FALSE;
16877+
#endif /* HAVE_WINDOWS_CONSOLE_IO */
1687416878
}
1687516879
#endif
1687616880

0 commit comments

Comments
 (0)