bug 8649: make sure we can exit if a test fails
authorGalen Charlton <gmc@esilibrary.com>
Thu, 16 Aug 2012 17:23:49 +0000 (13:23 -0400)
committerPaul Poulain <paul.poulain@biblibre.com>
Thu, 13 Sep 2012 09:55:47 +0000 (11:55 +0200)
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: wajasu <matted-34813@mypacks.net>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
t/db_dependent/Search.t

index 242f259..e949050 100644 (file)
@@ -502,12 +502,16 @@ warning_like {( undef, $results_hashref, $facets_loop ) =
     $results_hashref->{'biblioserver'}->{"RECORDS"});
 is($newresults[0]->{'alternateholdings_count'}, 1, 'Alternate holdings filled in correctly');
 
-kill 9, $child;
+END {
+    if ($child) {
+        kill 9, $child;
 
-# Clean up the Zebra files since the child process was just shot
+        # Clean up the Zebra files since the child process was just shot
 
-find(sub { unlink($_) if ( -f $_ && m/\.(mf|pid|LCK)$/ ); }, "$datadir");
-unlink("$datadir/var/run/zebradb/authoritysocket");
-unlink("$datadir/var/run/zebradb/bibliosocket");
+        find(sub { unlink($_) if ( -f $_ && m/\.(mf|pid|LCK)$/ ); }, "$datadir");
+        unlink("$datadir/var/run/zebradb/authoritysocket");
+        unlink("$datadir/var/run/zebradb/bibliosocket");
+    }
+}
 
 1;