rye
rye copied to clipboard
Rye::Cmd.rm sometimes fails to remove recursive directories
I have a method which simply removes an entire directory.
def remove_cache
# Remove the cache
begin
@system_rye.disable_safe_mode
@system_rye.rm(:r, :f, @@cache_path)
ensure
@system_rye.enable_safe_mode
end
end
Sometimes, seemingly random, the remove method will raise an errer and claim to be unable to remove the directory.
rm: cannot remove `/home/some_application/cache/map/http': Directory not empty
/home/rsahae/.rvm/gems/ruby-1.9.3-p327/gems/rye-0.9.8/lib/rye/box.rb:858:in `rescue in run_command': rm: cannot remove `/home/some_application/cache/map/http': Directory not empty (cmd: rm -r -f /home/some_application/cache/map; status: 1) (Rye::Err)
from /home/rsahae/.rvm/gems/ruby-1.9.3-p327/gems/rye-0.9.8/lib/rye/box.rb:809:in `run_command'
from /home/rsahae/.rvm/gems/ruby-1.9.3-p327/gems/rye-0.9.8/lib/rye/box.rb:473:in `method_missing'
from /home/rsahae/dev/maps_performance/lib/maps_performance/maps_performance_tester.rb:276:in `rescue in remove_cache'
from /home/rsahae/dev/maps_performance/lib/maps_performance/maps_performance_tester.rb:279:in `remove_cache'
from /home/rsahae/dev/maps_performance/lib/maps_performance/maps_performance_tester.rb:81:in `block in run_tests'
from /home/rsahae/dev/maps_performance/lib/maps_performance/maps_performance_tester.rb:69:in `each'
from /home/rsahae/dev/maps_performance/lib/maps_performance/maps_performance_tester.rb:69:in `run_tests'
from bin/maps_perf_test.rb:24:in `<main>'
Hmm, the error message is coming from the rm command and not rye itself. The only thing I can think of is that somehow the -r -f flags aren't being passed along. If it happens again, run rye with debugging enabled and send that output (Rye::DEBUG=true).