[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH 2/2] tests: Don't leave a libguestfs tmpdir lying around after running test-launch-race.pl.



Calling _exit(2) in the child process has the side effect that
tmp/libguestfsXXXXXX is not cleaned up.  Clean it up by ensuring the
handle is properly closed before _exit.
---
 tests/protocol/test-launch-race.pl | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/protocol/test-launch-race.pl b/tests/protocol/test-launch-race.pl
index 6fef1a5..f522cc1 100755
--- a/tests/protocol/test-launch-race.pl
+++ b/tests/protocol/test-launch-race.pl
@@ -42,7 +42,9 @@ if ($pid == 0) {
   my $g = Sys::Guestfs->new ();
   $g->add_drive ("/dev/null");
   $g->launch ();
-  _exit (0); # So the tmpdir is not removed.
+  $g->close ();
+  # So $tmpdir is not removed by CLEANUP => 1 above.
+  _exit (0);
 }
 
 my $g = Sys::Guestfs->new ();
-- 
2.5.0


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]