Skip to content

Commit b3d93aa

Browse files
fix: remove DWARF debug info as well if it's generated
1 parent e210c4c commit b3d93aa

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

lua/competitest/runner.lua

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,13 +123,43 @@ function TCRunner:run_testcase(tcindex)
123123
end
124124
end
125125

126+
local function rmdir(dir)
127+
local d = luv.fs_opendir(dir)
128+
if d then
129+
while true do
130+
local content = luv.fs_readdir(d, nil, 1)
131+
if not content then
132+
break
133+
end
134+
for _, entry in ipairs(content) do
135+
if entry.name ~= "." or entry.name ~= ".." then
136+
local path = dir .. "/" .. entry.name
137+
if entry.type == 'directory' then
138+
rmdir(path)
139+
elseif entry.type == 'file' then
140+
luv.fs_unlink(path)
141+
end
142+
end
143+
end
144+
end
145+
luv.fs_closedir(d)
146+
end
147+
luv.fs_rmdir(dir)
148+
end
149+
126150
---@private
127151
---Run the next unprocessed testcase, if any, and when it finishes run the successive unprocessed testcase, if any
128152
function TCRunner:run_next_testcase()
129153
if self.next_tc > #self.tcdata then
130154
local sep = vim.fn.has("win32") and "\\" or "/"
131155
local rc_exec = self.running_directory .. sep .. self.rc.exec
132156
os.remove(rc_exec)
157+
if vim.fn.has("mac") then
158+
local dsym = rc_exec .. ".dSYM"
159+
if vim.fn.isdirectory(dsym) then
160+
rmdir(dsym)
161+
end
162+
end
133163
return
134164
end
135165
self.next_tc = self.next_tc + 1

0 commit comments

Comments
 (0)