I don't see any return value from FileUtils commands.
I'd like to do something like:
really=(gets.chomp=="y")
if really
success = FileUtils.rm_rf "./PROJECT_#{@name}" #does not work
end
puts "./PROJECT_#{@name} deleted" if success
I read the documentation for FileUtils, and also read a "Getting executed command from ruby FileUtils", but I cannot figure how to use the answer.
According to the documentation ( http://ruby-doc.org/stdlib-1.9.3/libdoc/fileutils/rdoc/FileUtils.html#method-c-rm_rf ) calls to #rm_rf will not echo anything relevant to the task they are taking. #rm_rf actually calls #rm_r with option :force => true. This options enables the method to ignore the StandardError Exception (which would then communicate you something about the operation or why it is not working). Now, back to why it is failing. As somebody already commented, try with the option :secure => true. More info about this here: http://ruby-doc.org/stdlib-1.9.3/libdoc/fileutils/rdoc/FileUtils.html#method-c-remove_entry_secure . This is probably a permission issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With