Allow package removal to not error out on missing files, in case of files from a package having been manually removed (#9625)

* Allow package removal to not error out on missing files.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Use FileUtils to allow Exception option

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

---------

Signed-off-by: Satadru Pramanik <satadru@gmail.com>
This commit is contained in:
Satadru Pramanik, DO, MPH, MEng
2024-04-09 21:43:19 -04:00
committed by GitHub
parent 57dca3bde9
commit e133fa9430
2 changed files with 3 additions and 3 deletions

View File

@@ -36,7 +36,7 @@ class Command
puts "#{line} is in another package. It will not be removed during the removal of #{pkg.name}.".orange
else
puts "Removing file #{line}".yellow if verbose
FileUtils.remove_file line
FileUtils.remove_file line, exception: false
end
end
@@ -44,7 +44,7 @@ class Command
File.foreach(File.join(CREW_META_PATH, "#{pkg.name}.directorylist"), chomp: true) do |line|
next unless Dir.exist?(line) && Dir.empty?(line) && line.include?(CREW_PREFIX)
puts "Removing directory #{line}".yellow if verbose
Dir.rmdir line
FileUtils.remove_dir line, exception: false
end
# Remove the file and directory lists.