fix(wget): 确保fs模块在运行远程代码前已加载

添加对fs模块的显式检查和加载,避免在运行远程代码时因fs模块未加载而导致的错误。
This commit is contained in:
2025-08-31 20:47:45 +08:00
parent aab401937e
commit 1160a24a51

View File

@@ -5,6 +5,7 @@ if not package.loaded.http then
end
local http = require("http")
local fs = require("fs")
local args = {...}
@@ -30,6 +31,10 @@ end
if args[1] == "run" then
local data = get(args[2])
-- 确保fs模块已加载
if not _G.fs then
_G.fs = require("fs")
end
assert(load(data, "=<wget-run>", "t", _G))()
else
local filename = args[2] or (args[1]:match("[^/]+$")) or