Skip to content

Commit

Permalink
resolves #369 don't fail to delete tmp file
Browse files Browse the repository at this point in the history
  • Loading branch information
mojavelinux committed Dec 10, 2015
1 parent 8bf93d2 commit 390b20c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/asciidoctor-pdf/converter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2455,8 +2455,9 @@ def resolve_explicit_width attrs, max_width = bounds.width
# QUESTION is there a better way to do this?
# I suppose we could have @tmp_files as an instance variable on converter instead
# It might be sufficient to delete temporary files once per conversion
# NOTE Ruby 1.9 will sometimes delete a tmp file before the process exits
def unlink_tmp_file path
path.unlink if TemporaryPath === path
path.unlink if TemporaryPath === path && path.exist?
end

# QUESTION move to prawn/extensions.rb?
Expand Down
4 changes: 4 additions & 0 deletions lib/asciidoctor-pdf/temporary_path.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ module TemporaryPath
def unlink
::File.unlink self
end

def exist?
::File.file? self
end
end
end
end

0 comments on commit 390b20c

Please sign in to comment.