Browse files

acu66553 fix for not cleaning temp basedir in case of exception; temp…

… means temp
  • Loading branch information...
1 parent 35e7787 commit a9c3453779b393f86a9663aa04f2b36f2931ef3e @smessier smessier committed Dec 7, 2012
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/right_scraper/scraper.rb
View
6 lib/right_scraper/scraper.rb
@@ -95,12 +95,12 @@ def scrape(repo, incremental=true, &callback)
@resources += scraper.scrape
end
end
-
- # 3. Cleanup if temporary
- FileUtils.remove_entry_secure(@options[:basedir]) if @temporary
rescue Exception
# logger handles communication with the end user and appending
# to our error list, we just need to keep going.
+ ensure
+ # ensure basedir is always removed if temporary (even with errors).
+ ::FileUtils.remove_entry_secure(@options[:basedir]) rescue nil if @temporary
end
@logger.callback = nil
errors.size == errorlen

0 comments on commit a9c3453

Please sign in to comment.