]> git.donarmstrong.com Git - biopieces.git/commitdiff
corrected slight bug in grab
authormartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Tue, 3 Aug 2010 12:34:58 +0000 (12:34 +0000)
committermartinahansen <martinahansen@74ccb610-7750-0410-82ae-013aeee3265d>
Tue, 3 Aug 2010 12:34:58 +0000 (12:34 +0000)
git-svn-id: http://biopieces.googlecode.com/svn/trunk@1015 74ccb610-7750-0410-82ae-013aeee3265d

bp_bin/grab
code_ruby/Maasha/lib/biopieces.rb

index 95b82c8676e819d1390c3bbf2fa47b6e0e0b38b2..85063dec0234c82d30e481b15948fd55fc47ef37 100755 (executable)
@@ -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
     {
index 47b411d05be48100d4ef9b4d6e0f4b911f691f58..9c489920daaa792b4200633a6804767f4b775ea3 100644 (file)
@@ -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.