> require 'ftools' > require 'timeout' > > begin > Timeout.timeout(3){ > File.copy('temp.txt', 'temp.bak') > File.rename('temp.bak', '/X/temp.txt') > File.unlink('temp.bak') > } > rescue Errno::EPERM > # Ignore bogus EPERM errors - harmless > end > > The problem is that File.rename is raising Errno::EXDEV errors, and > simply ignoring those won't work. Shouldn't it be: File.copy('temp.txt', '/X/temp.bak') File.rename('/X/temp.bak', '/X/temp.txt')