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
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