rmtree can die instead of returning failure under some circumstances. We don't
want this to stop cleanup.
---
lib/Sys/VirtV2V/Target/RHEV.pm | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/lib/Sys/VirtV2V/Target/RHEV.pm b/lib/Sys/VirtV2V/Target/RHEV.pm
index 295c19d..c9add0c 100644
--- a/lib/Sys/VirtV2V/Target/RHEV.pm
+++ b/lib/Sys/VirtV2V/Target/RHEV.pm
@@ -390,9 +390,18 @@ sub _cleanup
return unless (defined($tmpdir));
- rmtree($tmpdir) or warn(user_message(__x("Unable to remove temporary ".
- "directory {dir}",
- dir => $tmpdir)));
+ eval {
+ rmtree($tmpdir) or warn(user_message(__x("Unable to remove temporary
".
+ "directory {dir}",
+ dir => $tmpdir)));
+ };
+
+ if ($@) {
+ warn(user_message(__x("Error removing temporary directory {dir}: ".
+ "{error}",
+ dir => $tmpdir, error => $@)));
+ }
+
$tmpdir = undef;
}
--
1.7.0.1