]> git.donarmstrong.com Git - biopieces.git/commitdiff
ruby code fixing exit
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Wed, 16 Jun 2010 12:41:28 +0000 (12:41 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Wed, 16 Jun 2010 12:41:28 +0000 (12:41 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@983 74ccb610-7750-0410-82ae-013aeee3265d

code_ruby/Maasha/lib/biopieces.rb

index 47e9f3df271cc13579ea73fe978f6e48a58e0248..f533247633daf9df341988d2bbadf0d98272f782 100644 (file)
@@ -4,7 +4,6 @@ require 'optparse'
 require 'open3'
 require 'pp'
 
-at_exit{ puts "All done, time to make sure log entry is written and tmpdir is removed." }
 
 # Biopieces are command line scripts and uses OptionParser to parse command line
 # options according to a list of casts. Each cast prescribes the long and short
@@ -83,23 +82,15 @@ class Biopieces
     path
   end
 
-  # Close Biopiece streams, remove tmp_dir, log status, and delete status file.
-  def clean
+  at_exit {
+    $stderr.puts "All done, time to make sure to close streams, remove tmpdir, and log entry."
+  
     @in.close  if @in.respond_to?  :close
     @out.close if @out.respond_to? :close
-    rmtmpdir
+    FileUtils.remove_entry_secure(@status.get_tmpdir)
     @status.log
     @status.delete
-  end
-
-  private
-
-  # Remove temporary directory, if existing, and it's content.
-  def rmtmpdir
-    tmp_path = @status.get_tmpdir 
-
-    FileUtils.remove_entry_secure(tmp_path)
-  end
+  }
 end