summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorruki <[email protected]>2026-02-07 11:02:38 +0800
committerGitHub <[email protected]>2026-02-07 11:02:38 +0800
commit15d8fed683b17f3bff4abb3d36f79fa291ac577c (patch)
tree044a4a9b8b824cdb7aba3a513b28ae701e69cd16 /core/src
parent4780a467c144f27a4c2f9923d030750d0f25f5a5 (diff)
parent08f5b8a7bdac97cab8f5055a5ae9b066d2b18664 (diff)
Merge pull request #7302 from xmake-io/missdll
Improve run process errors
Diffstat (limited to 'core/src')
-rw-r--r--core/src/xmake/engine.c2
-rw-r--r--core/src/xmake/winos/set_error_mode.c41
2 files changed, 43 insertions, 0 deletions
diff --git a/core/src/xmake/engine.c b/core/src/xmake/engine.c
index 9c02d8487..1a542bc7c 100644
--- a/core/src/xmake/engine.c
+++ b/core/src/xmake/engine.c
@@ -279,6 +279,7 @@ tb_int_t xm_winos_registry_keys(lua_State *lua);
tb_int_t xm_winos_registry_values(lua_State *lua);
tb_int_t xm_winos_short_path(lua_State *lua);
tb_int_t xm_winos_processes(lua_State* lua);
+tb_int_t xm_winos_set_error_mode(lua_State *lua);
#endif
// the utf8 functions
@@ -485,6 +486,7 @@ static luaL_Reg const g_winos_functions[] = {
{ "registry_values", xm_winos_registry_values },
{ "short_path", xm_winos_short_path },
{ "processes", xm_winos_processes },
+ { "set_error_mode", xm_winos_set_error_mode },
{ tb_null, tb_null },
};
#endif
diff --git a/core/src/xmake/winos/set_error_mode.c b/core/src/xmake/winos/set_error_mode.c
new file mode 100644
index 000000000..ceff4684b
--- /dev/null
+++ b/core/src/xmake/winos/set_error_mode.c
@@ -0,0 +1,41 @@
+/*!A cross-platform build utility based on Lua
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Copyright (C) 2015-present, Xmake Open Source Community.
+ *
+ * @author ruki
+ * @file set_error_mode.c
+ *
+ */
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * trace
+ */
+#define TB_TRACE_MODULE_NAME "set_error_mode"
+#define TB_TRACE_MODULE_DEBUG (0)
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * includes
+ */
+#include "prefix.h"
+
+/* //////////////////////////////////////////////////////////////////////////////////////
+ * implementation
+ */
+
+tb_int_t xm_winos_set_error_mode(lua_State *lua) {
+ tb_size_t mode = (tb_size_t)luaL_checkinteger(lua, 1);
+ lua_pushinteger(lua, (tb_int_t)SetErrorMode((UINT)mode));
+ return 1;
+}