Need to close files before unlinking them on Win32
authorSteve Hay <SteveHay@planit.com>
Mon, 10 Jan 2005 11:53:10 +0000 (11:53 +0000)
committerSteve Hay <SteveHay@planit.com>
Mon, 10 Jan 2005 11:53:10 +0000 (11:53 +0000)
(Various files created by test programs are left behind otherwise,
and distclean doesn't clean them up)

p4raw-id: //depot/perl@23778

lib/FileCache/t/01open.t
lib/FileCache/t/04twoarg.t
lib/FileCache/t/07noimport.t
t/op/read.t

index fa7f5f0..75da3b2 100644 (file)
@@ -20,6 +20,7 @@ print "1..1\n";
      for my $path ( @files ){
         cacheout $path;
         print $path "$path 1\n";
+        close $path;
      }
      print "not " unless scalar map({ -f } @files) == scalar @files;
      print "ok 1\n";
index a2a70be..66da971 100644 (file)
@@ -21,4 +21,5 @@ print "1..1\n";
      seek(foo, 0, 0);
      print 'not ' unless <foo> eq "foo 44\n";
      print "ok 1\n";
+     close foo;
 }
index 0f19ada..d2f926c 100644 (file)
@@ -22,4 +22,5 @@ plan( tests => 1 );
 
     FileCache::cacheout("<", $file);
     ::ok( <$file> eq "bar" );
+    close $file;
 }
index 4aaaeab..99a6216 100755 (executable)
@@ -35,7 +35,7 @@ my $has_perlio = !eval {
 
 my $tmpfile = 'Op_read.tmp';
 
-1 while unlink $tmpfile;
+END { 1 while unlink $tmpfile }
 
 my (@values, @buffers) = ('', '');
 
@@ -90,6 +90,7 @@ foreach my $value (@values) {
                    $got = read (FH, $buffer, $length, $offset);
                    is ($got, length $will_read, "got $what");
                    is ($buffer, $expect, "buffer $what");
+                   close FH;
                }
            }
        }