summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaikari <[email protected]>2026-02-05 23:36:25 +0300
committerSaikari <[email protected]>2026-02-05 23:36:25 +0300
commitb51f3b5f386c18504be698ea9c14953c8b289605 (patch)
tree602fc0e838d8331970aa03e5412a5c744ff5e99f
parentbb7879934dca1ef7b26584f4dfadc29462d5a059 (diff)
fix logic
-rw-r--r--core/src/xmake/process/openv.c27
-rw-r--r--xmake/core/base/os.lua3
2 files changed, 29 insertions, 1 deletions
diff --git a/core/src/xmake/process/openv.c b/core/src/xmake/process/openv.c
index 223d2d774..b9020cb2c 100644
--- a/core/src/xmake/process/openv.c
+++ b/core/src/xmake/process/openv.c
@@ -34,6 +34,9 @@
defined(TB_CONFIG_OS_HAIKU) || defined(TB_COMPILER_IS_MINGW)
#include <signal.h>
#endif
+#ifdef TB_CONFIG_OS_WINDOWS
+#include <windows.h>
+#endif
/* //////////////////////////////////////////////////////////////////////////////////////
* implementation
@@ -100,6 +103,12 @@ tb_int_t xm_process_openv(lua_State *lua) {
// init attributes
tb_process_attr_t attr = { 0 };
+#ifdef TB_CONFIG_OS_WINDOWS
+ // the error mode
+ UINT old_error_mode = 0;
+ tb_bool_t set_error_mode = tb_false;
+#endif
+
// get option arguments
tb_bool_t exclusive = tb_false;
tb_size_t envn = 0;
@@ -130,6 +139,17 @@ tb_int_t xm_process_openv(lua_State *lua) {
}
lua_pop(lua, 1);
+#ifdef TB_CONFIG_OS_WINDOWS
+ // save winos error mode?
+ lua_pushstring(lua, "winos_error_mode_gui");
+ lua_gettable(lua, 3);
+ if (lua_toboolean(lua, -1)) {
+ old_error_mode = SetErrorMode(0);
+ set_error_mode = tb_true;
+ }
+ lua_pop(lua, 1);
+#endif
+
// get curdir
lua_pushstring(lua, "curdir");
lua_gettable(lua, 3);
@@ -323,6 +343,13 @@ tb_int_t xm_process_openv(lua_State *lua) {
lua_pushnil(lua);
}
+#ifdef TB_CONFIG_OS_WINDOWS
+ // restore error mode
+ if (set_error_mode) {
+ SetErrorMode(old_error_mode);
+ }
+#endif
+
// exit argv
if (argv) {
tb_free(argv);
diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua
index ae730738e..0607bb209 100644
--- a/xmake/core/base/os.lua
+++ b/xmake/core/base/os.lua
@@ -994,7 +994,8 @@ function os.execv(program, argv, opt)
stderr = opt.stderr,
curdir = opt.curdir,
detach = opt.detach,
- exclusive = opt.exclusive}
+ exclusive = opt.exclusive,
+ winos_error_mode_gui = opt.winos_error_mode_gui}
-- profile process performance
local runtime