mirror of
https://github.com/CCLeonOS/LeonOS.git
synced 2026-03-03 06:47:00 +00:00
fix(wget): 确保fs模块在运行远程代码前已加载
添加对fs模块的显式检查和加载,避免在运行远程代码时因fs模块未加载而导致的错误。
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user