]> git.donarmstrong.com Git - biopieces.git/blobdiff - bp_bin/biostat
refactoring of assemble_pairs
[biopieces.git] / bp_bin / biostat
index b751e95ea60e22d36b1335ecfbaab98239dd7bd5..c0b7c13971ba1c938dcc11650918954dd8a5eef5 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env perl -w
+#!/usr/bin/env perl
 
 # Copyright (C) 2007-2009 Martin A. Hansen.
 
@@ -26,6 +26,7 @@
 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 
 
+use warnings;
 use strict;
 use Maasha::Biopieces;
 use Maasha::Common;
@@ -75,11 +76,6 @@ while ( 1 )
 
             push @table, $info;
         }
-        else
-        {
-            print STDERR "Removing stale file: $file\n";
-            unlink $file;
-        }
     }
 
     if ( $options->{ 'sort' } =~ /^(USER|TMP_DIR|START_TIME|RUN_TIME|COMMAND)$/ ) {
@@ -167,9 +163,13 @@ sub get_status_info
 
     my ( $fh, $line, $time, $args, $tmp_dir, $du );
 
-    $fh = Maasha::Filesys::file_read_open( $file );
-    $line = <$fh>;
-    close $fh;
+    if (-e $file)
+    {
+        $fh = Maasha::Filesys::file_read_open( $file );
+        flock($fh, 1);
+        $line = <$fh>;
+        close $fh;
+    }
 
     chomp $line;