From: martinahansen Date: Tue, 3 Aug 2010 12:34:58 +0000 (+0000) Subject: corrected slight bug in grab X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=2ea9743691410c29f94d49c03e0ea7617bc9e372;p=biopieces.git corrected slight bug in grab git-svn-id: http://biopieces.googlecode.com/svn/trunk@1015 74ccb610-7750-0410-82ae-013aeee3265d --- diff --git a/bp_bin/grab b/bp_bin/grab index 95b82c8..85063de 100755 --- a/bp_bin/grab +++ b/bp_bin/grab @@ -228,7 +228,7 @@ sub grab_regex if ( $keys ) { - map { return 1 if $record->{ $_ } =~ /$regex/ } @{ $keys }; + map { return 1 if exists $record->{ $_ } and $record->{ $_ } =~ /$regex/ } @{ $keys }; } else { diff --git a/code_ruby/Maasha/lib/biopieces.rb b/code_ruby/Maasha/lib/biopieces.rb index 47b411d..9c48992 100644 --- a/code_ruby/Maasha/lib/biopieces.rb +++ b/code_ruby/Maasha/lib/biopieces.rb @@ -4,6 +4,19 @@ require 'optparse' require 'open3' require 'pp' +@exit_status = nil + +%w( INT TERM QUIT ).each do |signal| + Signal.trap(signal) do + exit_status = signal + exit + end +end + +at_exit { + pp @exit_status +} + # 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 # name of the option, the type, if it is mandatory, the default value, and allowed @@ -248,7 +261,7 @@ class Casts < Array end -# Class for parsing argv using OptionParser accordind to given casts. +# Class for parsing argv using OptionParser according to given casts. # Default options are set, file glob expressions expanded, and options are # checked according to the casts. Usage information is printed and exit called # if required.