566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
|
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
|
-
+
|
* In both cases above we will return success but with nbytesread as 0.
* This allows caller to check for thread termination etc.
*
* See https://bugs.python.org/issue30237
* or https://github.com/microsoft/terminal/issues/12143
*/
nRead = (DWORD)-1;
if (!ReadConsoleW(hConsole, lpBuffer, nChars, &nRead, NULL)) {
if (!ReadConsoleW(hConsole, lpBuffer, (DWORD)nChars, &nRead, NULL)) {
return GetLastError();
}
if ((nRead == 0 || nRead == (DWORD)-1)
&& GetLastError() == ERROR_OPERATION_ABORTED) {
nRead = 0;
}
*nCharsReadPtr = nRead;
|
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
|
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
|
-
+
|
Tcl_Size nChars,
Tcl_Size *nCharsWrittenPtr)
{
DWORD nCharsWritten;
/* See comments in ReadConsoleChars, not sure that applies here */
nCharsWritten = (DWORD)-1;
if (!WriteConsoleW(hConsole, lpBuffer, nChars, &nCharsWritten, NULL)) {
if (!WriteConsoleW(hConsole, lpBuffer, (DWORD)nChars, &nCharsWritten, NULL)) {
return GetLastError();
}
if (nCharsWritten == (DWORD) -1) {
nCharsWritten = 0;
}
*nCharsWrittenPtr = nCharsWritten;
return 0;
|
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
|
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
|
-
+
|
if ((chanInfoPtr->flags & CONSOLE_ASYNC)
|| (chanInfoPtr->watchMask & TCL_READABLE)) {
handleInfoPtr->flags |= CONSOLE_DATA_AWAITED;
WakeConditionVariable(&handleInfoPtr->consoleThreadCV);
}
ReleaseSRWLockExclusive(&handleInfoPtr->lock);
return numRead;
return (int)numRead;
}
/*
*----------------------------------------------------------------------
*
* ConsoleOutputProc --
*
|
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
|
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
|
-
+
|
}
}
/* Lock must have been reacquired before continuing loop */
}
WakeConditionVariable(&handleInfoPtr->consoleThreadCV);
ReleaseSRWLockExclusive(&handleInfoPtr->lock);
return numWritten;
return (int)numWritten;
}
/*
*----------------------------------------------------------------------
*
* ConsoleEventProc --
*
|