From 0e593c1a6eaefca1b895b98ad247a188d4c9f39b Mon Sep 17 00:00:00 2001 From: martinahansen Date: Wed, 16 Jun 2010 12:41:28 +0000 Subject: [PATCH] ruby code fixing exit git-svn-id: http://biopieces.googlecode.com/svn/trunk@983 74ccb610-7750-0410-82ae-013aeee3265d --- code_ruby/Maasha/lib/biopieces.rb | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/code_ruby/Maasha/lib/biopieces.rb b/code_ruby/Maasha/lib/biopieces.rb index 47e9f3d..f533247 100644 --- a/code_ruby/Maasha/lib/biopieces.rb +++ b/code_ruby/Maasha/lib/biopieces.rb @@ -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 -- 2.39.5