Skip to content

Instantly share code, notes, and snippets.

@cfitz
Created May 28, 2015 15:21
Show Gist options
  • Select an option

  • Save cfitz/458971779bf200f80fb0 to your computer and use it in GitHub Desktop.

Select an option

Save cfitz/458971779bf200f80fb0 to your computer and use it in GitHub Desktop.
converter.rb
# 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