Created
May 28, 2015 15:21
-
-
Save cfitz/458971779bf200f80fb0 to your computer and use it in GitHub Desktop.
converter.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # put this file in | |
| # plugins/local/backend/model/converter.rb | |
| # and restart aspace. | |
| class Converter | |
| # forcibly remove files in the event of an interruption | |
| def remove_files | |
| @batch.each_open_file_path do |path| | |
| 3.times do |i| | |
| begin | |
| File.unlink(path) | |
| break | |
| rescue Errno::EACCES # sometimes windows does not like this. let's wait and retry. | |
| sleep(1) # just in case it's open by something else.. | |
| next unless i == 2 | |
| $stderr.puts "Cannot remove #{path}...giving up." | |
| end | |
| end | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment