fix(lua): don't remove first char of non-file stacktrace source (#37008)

This commit is contained in:
zeertzjq
2025-12-18 08:09:16 +08:00
committed by GitHub
parent c172fd9f46
commit c08139d790
5 changed files with 5 additions and 5 deletions

View File

@@ -1252,7 +1252,7 @@ local function traceback()
if not info then
break
end
local msg = (' %s:%s'):format(info.source:sub(2), info.currentline)
local msg = (' %s:%s'):format(info.source:gsub('^@', ''), info.currentline)
table.insert(backtrace, msg)
level = level + 1
end

View File

@@ -492,7 +492,7 @@ function M._profile(opts)
if opts and opts.loaders then
for l, loader in pairs(loaders) do
local loc = debug.getinfo(loader, 'Sn').source:sub(2)
local loc = debug.getinfo(loader, 'Sn').source:gsub('^@', '')
loaders[l] = track('loader ' .. l .. ': ' .. loc, loader)
end
end