summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThijs Schreijer <thijs@thijsschreijer.nl>2024-05-22 23:23:55 +0200
committerThijs Schreijer <thijs@thijsschreijer.nl>2024-05-22 23:23:55 +0200
commitc08ea611759407b0e0c8dbea384c4f5273d27d3f (patch)
tree44b52dcca88bbbc4c92efc0f187adb7332637dcb
parent34e1632092d1a9695b539d0244ce948194ed76c9 (diff)
downloadluasystem-c08ea611759407b0e0c8dbea384c4f5273d27d3f.zip
fix
-rw-r--r--src/term.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/term.c b/src/term.c
index 18e6acb..704da80 100644
--- a/src/term.c
+++ b/src/term.c
@@ -656,6 +656,12 @@ static int lst_setnonblock(lua_State *L)
return pusherror(L, "Error changing O_NONBLOCK: ");
}
+#else
+ HANDLE console_handle = get_console_handle(L, 1);
+ if (console_handle == NULL) {
+ return 2; // error message is already on the stack
+ }
+
#endif
lua_pushboolean(L, 1);
@@ -691,6 +697,11 @@ static int lst_getnonblock(lua_State *L)
}
#else
+ HANDLE console_handle = get_console_handle(L, 1);
+ if (console_handle == NULL) {
+ return 2; // error message is already on the stack
+ }
+
lua_pushboolean(L, 0);
#endif