@@ -164,6 +164,8 @@ function makedemos(source::String, templates::Union{Dict, Nothing} = nothing;
164
164
end
165
165
if clean_builddir
166
166
@info " Remove DemoCards build dir: $absolute_root "
167
+ # Ref: https://discourse.julialang.org/t/find-what-has-locked-held-a-file/23278/2
168
+ Base. Sys. iswindows () && GC. gc ()
167
169
rm (absolute_root; force= true , recursive= true )
168
170
else
169
171
error (" Stopped demos build." )
@@ -200,12 +202,18 @@ function makedemos(source::String, templates::Union{Dict, Nothing} = nothing;
200
202
end
201
203
202
204
@info " Clean up DemoCards build dir: \" $source \" "
205
+ # Ref: https://discourse.julialang.org/t/find-what-has-locked-held-a-file/23278/2
206
+ Base. Sys. iswindows () && GC. gc ()
203
207
rm (absolute_root; force= true , recursive= true )
204
208
205
209
if ! isnothing (theme_assets)
206
210
assets_path = abspath (root, src, theme_assets)
211
+ # Ref: https://discourse.julialang.org/t/find-what-has-locked-held-a-file/23278/2
212
+ Base. Sys. iswindows () && GC. gc ()
207
213
rm (assets_path, force= true )
208
214
if (isempty (readdir (dirname (assets_path))))
215
+ # Ref: https://discourse.julialang.org/t/find-what-has-locked-held-a-file/23278/2
216
+ Base. Sys. iswindows () && GC. gc ()
209
217
rm (dirname (assets_path))
210
218
end
211
219
end
@@ -216,6 +224,8 @@ function makedemos(source::String, templates::Union{Dict, Nothing} = nothing;
216
224
catch err
217
225
# clean up build dir if anything wrong happens here so that we _hopefully_ never trigger the
218
226
# user prompt logic before the build process.
227
+ # Ref: https://discourse.julialang.org/t/find-what-has-locked-held-a-file/23278/2
228
+ Base. Sys. iswindows () && GC. gc ()
219
229
rm (absolute_root; force= true , recursive= true )
220
230
@error " Errors when building demo dir" pwd= pwd () source root src
221
231
rethrow (err)
0 commit comments