Merge pull request #715 from JacobBarthelmeh/examples

case of non-console ouptut handle
pull/721/head
John Safranek 2024-07-10 11:20:32 -07:00 committed by GitHub
commit 0f9e87357b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 21 deletions

View File

@ -406,10 +406,9 @@ static THREAD_RET readPeer(void* in)
if (args->rawMode == 0) {
DWORD wrd;
if (GetConsoleMode(stdoutHandle, &wrd) == FALSE) {
err_sys("Unable to get stdout handle");
}
/* get console mode will fail on handles that are not a console,
* i.e. if the stdout is being redirected to a file */
if (GetConsoleMode(stdoutHandle, &wrd) != FALSE) {
/* depend on the terminal to process VT characters */
#ifndef _WIN32_WINNT_WIN10
/* support for virtual terminal processing was introduced in windows 10 */
@ -422,6 +421,7 @@ static THREAD_RET readPeer(void* in)
err_sys("Unable to set console mode");
}
}
}
/* set handle to use for window resize */
wc_LockMutex(&args->lock);

View File

@ -370,10 +370,9 @@ static THREAD_RET readPeer(void* in)
if (args->rawMode == 0) {
DWORD wrd;
if (GetConsoleMode(stdoutHandle, &wrd) == FALSE) {
err_sys("Unable to get stdout handle");
}
/* get console mode will fail on handles that are not a console,
* i.e. if the stdout is being redirected to a file */
if (GetConsoleMode(stdoutHandle, &wrd) != FALSE) {
/* depend on the terminal to process VT characters */
#ifndef _WIN32_WINNT_WIN10
/* support for virtual terminal processing was introduced in windows 10 */
@ -386,6 +385,7 @@ static THREAD_RET readPeer(void* in)
err_sys("Unable to set console mode");
}
}
}
/* set handle to use for window resize */
wc_LockMutex(&args->lock);