Displaying 1 result from an estimated 1 matches for "add_on_close".
2010 Jun 17
2
[PATCH] Improve cleanup of libguestfs handle with Sys::VirtV2V::GuestfsHandle
...r, $self->{transfer_mount});
- $self->{transfer_mounted} = 1;
- # We'll need this to unmount in DESTROY
- $self->{g} = $g;
+ # Umount and remove the transfer mount point before the guestfs
+ # handle is closed
+ $g->add_on_close(sub {
+ $g->umount($self->{transfer_mount});
+ $g->rmdir($self->{transfer_mount});
+ });
}
}
@@ -498,19 +501,6 @@ sub set_default_net_mapping
$self->{default_net_mapping} = [ $name, $type ];
}
-sub DESTROY
-{
- my $s...