Update of /cvsroot/fink/fink/t/Finally
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28412/t/Finally

Modified Files:
        ChangeLog finally.t 
Log Message:
finalizers should not run in forks

Index: finally.t
===================================================================
RCS file: /cvsroot/fink/fink/t/Finally/finally.t,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- finally.t   22 Mar 2006 04:00:33 -0000      1.1
+++ finally.t   22 Mar 2006 18:17:01 -0000      1.2
@@ -5,6 +5,9 @@
 use Test::More 'no_plan';
 use File::Temp qw(tempfile);
 
+use Fink::Services     qw(lock_wait);
+use Fink::Command      qw(touch);
+
 BEGIN { use_ok 'Fink::Finally'; }
 
 # bad args
@@ -62,7 +65,7 @@
 my $finally = Fink::Finally->new(sub { print "cleanup\n" });
 exit 0;
 SCRIPT
-       my ($fh, $fname) = tempfile(".capture.XXXX");
+       my ($fh, $fname) = tempfile("capture.XXXX");
        print $fh $script;
        close $fh;
        
@@ -85,3 +88,23 @@
        } # out of scope
        is($x, 0, 'cancellation');
 }
+
+# fork doesn't run in subproc
+{
+       my $dummy;
+       ($dummy, my $file) = tempfile("capture.fork.XXXX");
+       touch($file);
+       
+       {
+               my $fork; # did we fork or not?
+               my $fin = Fink::Finally->new(sub { unlink $file });
+               
+               $fork = fork;
+               if ($fork) {
+                       wait;
+                       ok(-f $file, "fork doesn't run in subproc");
+               }
+       }
+}
+
+       

Index: ChangeLog
===================================================================
RCS file: /cvsroot/fink/fink/t/Finally/ChangeLog,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ChangeLog   22 Mar 2006 04:00:33 -0000      1.1
+++ ChangeLog   22 Mar 2006 18:17:01 -0000      1.2
@@ -1,3 +1,7 @@
+2006-03-22  Dave Vasilevsky  <[EMAIL PROTECTED]>
+
+       * finally.t: Test what happens when we fork.
+
 2006-03-21  Dave Vasilevsky  <[EMAIL PROTECTED]>
 
        * NEW DIRECTORY, finally.t: Test Fink::Finally.



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Fink-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fink-commits

Reply via email to