File tree 1 file changed +14
-2
lines changed
Filter options
1 file changed +14
-2
lines changed
Original file line number Diff line number Diff line change @@ -292,13 +292,22 @@ func (e *Executor) Config(loadDotEnv bool) error {
292
292
}
293
293
294
294
func (e * Executor ) CleanupTemporaryDirectories () {
295
- go cleanupStaleTemporaryDirectories (e .Logger )
295
+ backgroundCleanup := make (chan bool , 1 )
296
+ go cleanupStaleTemporaryDirectories (e .Logger , backgroundCleanup )
297
+
296
298
if e .iniDir != "" {
297
299
os .RemoveAll (e .iniDir )
298
300
}
299
301
if e .tempDir != "" {
300
302
os .RemoveAll (e .tempDir )
301
303
}
304
+
305
+ // give some room to the background clean up job to do its work
306
+ select {
307
+ case <- backgroundCleanup :
308
+ case <- time .After (100 * time .Millisecond ):
309
+ e .Logger .Debug ().Msg ("Allocated time for temporary directories to be cleaned up is over, it will resume later on" )
310
+ }
302
311
}
303
312
304
313
// The Symfony CLI used to leak temporary directories until v5.10.8. The bug is
@@ -307,7 +316,10 @@ func (e *Executor) CleanupTemporaryDirectories() {
307
316
// in-use by running servers we can't simply delete the parent directory. This
308
317
// is why we make our best to find the oldest directories and remove then,
309
318
// cleaning the directory little by little.
310
- func cleanupStaleTemporaryDirectories (mainLogger zerolog.Logger ) {
319
+ func cleanupStaleTemporaryDirectories (mainLogger zerolog.Logger , doneCh chan <- bool ) {
320
+ defer func () {
321
+ doneCh <- true
322
+ }()
311
323
parentDirectory := filepath .Join (util .GetHomeDir (), "tmp" )
312
324
mainLogger = mainLogger .With ().Str ("dir" , parentDirectory ).Logger ()
313
325
You can’t perform that action at this time.
0 commit comments