Skip to content

Commit a9a549f

Browse files
fix: remove DWARF debug info as well if it's generated
1 parent 90b2a9e commit a9a549f

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
@@ -105,6 +105,30 @@ function TCRunner:run_testcases(tctbl, compile)
105105
mut = math.min(tc_size, mut)
106106
local next_tc = 1
107107

108+
local function rmdir(dir)
109+
local d = luv.fs_opendir(dir)
110+
if d then
111+
while true do
112+
local content = luv.fs_readdir(d, nil, 1)
113+
if not content then
114+
break
115+
end
116+
for _, entry in ipairs(content) do
117+
if entry.name ~= "." or entry.name ~= ".." then
118+
local path = dir .. "/" .. entry.name
119+
if entry.type == 'directory' then
120+
rmdir(path)
121+
elseif entry.type == 'file' then
122+
luv.fs_unlink(path)
123+
end
124+
end
125+
end
126+
end
127+
luv.fs_closedir(d)
128+
end
129+
luv.fs_rmdir(dir)
130+
end
131+
108132
function self.run_next_tc(tcnum)
109133
if tcnum then
110134
if tcnum == 1 and self.compile then
@@ -117,6 +141,12 @@ function TCRunner:run_testcases(tctbl, compile)
117141
if next_tc > tc_size then
118142
if self.compile and self.config.remove_compiled_binary and vim.fn.filereadable(self.rc.exec) then
119143
os.remove(self.rc.exec)
144+
if vim.fn.has("mac") then
145+
local dsym = self.rc.exec .. ".dSYM"
146+
if vim.fn.isdirectory(dsym) then
147+
rmdir(dsym)
148+
end
149+
end
120150
end
121151
return
122152
end

0 commit comments

Comments
 (0)