Skip to content

Commit 32732d4

Browse files
committed
FEAT: throwing error if QUERY on INPUT port fails from some reason
1 parent a21eecc commit 32732d4

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/core/p-console.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,11 @@
138138
Set_Block(D_RET, Get_Object_Words(spec));
139139
return R_RET;
140140
}
141-
if (OS_DO_DEVICE(req, RDC_QUERY) < 0) return R_NONE;
141+
if (OS_DO_DEVICE(req, RDC_QUERY) < 0) {
142+
SET_INTEGER(arg, req->error);
143+
Trap1(RE_PROTOCOL, arg);
144+
//return R_NONE;
145+
}
142146

143147
Ret_Query_Console(req, D_RET, D_ARG(ARG_QUERY_FIELD), spec);
144148
break;

src/os/win32/dev-stdio.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,10 @@ static void close_stdio(void)
463463
***********************************************************************/
464464
{
465465
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
466-
GetConsoleScreenBufferInfo(Std_Out, &csbiInfo);
466+
if(0 == GetConsoleScreenBufferInfo(Std_Out, &csbiInfo)) {
467+
req->error = GetLastError();
468+
return DR_ERROR;
469+
}
467470
req->console.buffer_rows = csbiInfo.dwSize.Y;
468471
req->console.buffer_cols = csbiInfo.dwSize.X;
469472
req->console.window_rows = csbiInfo.srWindow.Bottom - csbiInfo.srWindow.Top + 1;

0 commit comments

Comments
 (0)