diff options
Diffstat (limited to 'xmake/core/sandbox/modules/os.lua')
| -rw-r--r-- | xmake/core/sandbox/modules/os.lua | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/xmake/core/sandbox/modules/os.lua b/xmake/core/sandbox/modules/os.lua index 197356ffa..5718f8dec 100644 --- a/xmake/core/sandbox/modules/os.lua +++ b/xmake/core/sandbox/modules/os.lua @@ -494,7 +494,24 @@ function sandbox_os.execv(program, argv, opt) -- run it opt = opt or {} + + -- check policy for GUI error dialogs (Windows only) + local old_mode + local winos + if os.is_host("windows") and opt.winos_error_mode_gui then + winos = require("sandbox/modules/winos") + if winos.seterrormode then + old_mode = winos.seterrormode(0) + end + end + local ok, errors = os.execv(program, argv, opt) + + -- restore error mode + if old_mode then + winos.seterrormode(old_mode) + end + if ok ~= 0 and not opt.try then -- get command @@ -509,6 +526,8 @@ function sandbox_os.execv(program, argv, opt) local missing_dlls = _get_missing_dlls(program) if #missing_dlls > 0 then errors = string.format("execv(%s) failed(%d): system error 0xC0000135 (STATUS_DLL_NOT_FOUND).\nThe application failed to start because the following DLLs were not found:\n - %s\nPlease check your PATH environment variable or copy the missing DLLs to the executable directory.", cmd, ok, table.concat(missing_dlls, "\n - ")) + else + errors = string.format("execv(%s) failed(%d): system error 0xC0000135 (STATUS_DLL_NOT_FOUND).\nThe application failed to start because a dependent DLL was not found.\nPlease check your PATH environment variable or copy the missing DLL to the executable directory.", cmd, ok) end else errors = string.format("execv(%s) failed(%d)", cmd, ok) |
