File tree 1 file changed +6
-1
lines changed
1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -330,6 +330,8 @@ def unlink
330
330
return
331
331
end
332
332
333
+ @finalizer_manager . unlinked = true
334
+
333
335
@unlinked = true
334
336
end
335
337
alias delete unlink
@@ -366,10 +368,13 @@ def inspect
366
368
attr_reader :unlinked , :mode , :opts , :finalizer_manager
367
369
368
370
class FinalizerManager # :nodoc:
371
+ attr_accessor :unlinked
372
+
369
373
def initialize ( path )
370
374
@open_files = { }
371
375
@path = path
372
376
@pid = Process . pid
377
+ @unlinked = false
373
378
end
374
379
375
380
def register ( obj , file )
@@ -381,7 +386,7 @@ def register(obj, file)
381
386
def call ( object_id )
382
387
@open_files . delete ( object_id ) . close
383
388
384
- if @open_files . empty? && Process . pid == @pid
389
+ if @open_files . empty? && ! @unlinked && Process . pid == @pid
385
390
$stderr. puts "removing #{ @path } ..." if $DEBUG
386
391
begin
387
392
File . unlink ( @path )
You can’t perform that action at this time.
0 commit comments