summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-04-02 22:52:07 +0800
committerruki <[email protected]>2024-04-02 22:52:07 +0800
commitd2c877aa407931a0a385d7937cd06e13b15ecfea (patch)
tree6beba6832cc9ade1b887f12c7ae531e0c0707cd1
parentf0cb5ad5d4aa420151f87ad497656bc68be182da (diff)
improve to call native module
-rw-r--r--xmake/core/sandbox/modules/import/core/sandbox/module.lua10
1 files changed, 9 insertions, 1 deletions
diff --git a/xmake/core/sandbox/modules/import/core/sandbox/module.lua b/xmake/core/sandbox/modules/import/core/sandbox/module.lua
index 939478150..fc38747ba 100644
--- a/xmake/core/sandbox/modules/import/core/sandbox/module.lua
+++ b/xmake/core/sandbox/modules/import/core/sandbox/module.lua
@@ -218,9 +218,17 @@ function core_sandbox_module._load_from_binary(module_fullpath, opt)
for _, arg in ipairs(table.pack(...)) do
table.insert(argv, tostring(arg))
end
- local ok, outdata, errdata = os.iorunv(binaryfile, argv, {curdir = module_bindir})
+ local ok, outdata, errdata, errors = os.iorunv(binaryfile, argv)
if ok then
return outdata
+ else
+ if not errors then
+ errors = errdata or ""
+ if #errors:trim() == 0 then
+ errors = outdata or ""
+ end
+ end
+ os.raise({errors = errors, stderr = errdata, stdout = outdata})
end
end
end