diff --git a/lib/review/epubmaker.rb b/lib/review/epubmaker.rb index e056547cb..941c4b3c8 100644 --- a/lib/review/epubmaker.rb +++ b/lib/review/epubmaker.rb @@ -135,7 +135,7 @@ def produce(yamlfile, bookname = nil) @producer.produce("#{bookname}.epub", basetmpdir, epubtmpdir) log('Finished.') ensure - FileUtils.remove_entry_secure basetmpdir unless @config['debug'] + FileUtils.remove_entry_secure(basetmpdir) unless @config['debug'] end end @@ -364,7 +364,8 @@ def detect_properties(path) def write_info_body(basetmpdir, _id, filename, ispart = nil, chaptype = nil) headlines = [] path = File.join(basetmpdir, filename) - Document.parse_stream(File.new(path), ReVIEWHeaderListener.new(headlines)) + htmlio = File.new(path) + Document.parse_stream(htmlio, ReVIEWHeaderListener.new(headlines)) properties = detect_properties(path) prop_str = '' prop_str = ',properties=' + properties.join(' ') if properties.present? @@ -378,6 +379,7 @@ def write_info_body(basetmpdir, _id, filename, ispart = nil, chaptype = nil) first = nil end end + htmlio.close end def push_contents(_basetmpdir)