[padb-devel] [padb] r146 committed - Catch the case where message queues are inspected but the minfo binary...

codesite-noreply at google.com codesite-noreply at google.com
Mon Aug 24 18:33:22 BST 2009


Revision: 146
Author: apittman
Date: Mon Aug 24 10:33:09 2009
Log: Catch the case where message queues are inspected but the minfo binary
isn't found.  Detect this case and report a sensible error message
to the user.

http://code.google.com/p/padb/source/detail?r=146

Modified:
  /trunk/src/padb

=======================================
--- /trunk/src/padb	Mon Aug 24 08:50:05 2009
+++ /trunk/src/padb	Mon Aug 24 10:33:09 2009
@@ -4400,6 +4400,10 @@
  sub output {
      my ( $vp, $str ) = @_;

+    if ( not defined $str ) {
+        carp("no output");
+    }
+
      push( @{ $inner_output{$vp} }, $str );

  }
@@ -4942,15 +4946,31 @@
                  debug( $vp, "Failed dll request $r\n" );
              }
          } else {
-            push @mq, $r;
+            push( @mq, $r );
          }
      }
+
+    my $sc = keys(%stats);

      waitpid( $h->{hpid}, 0 );
      close( $h->{rdr} );
      close( $h->{wtr} );
      close( $h->{err} );

+    if ( $sc == 0 ) {
+
+        # No interaction was had with minfo, abort with nothing.
+        target_error( $vp, "Error running $confInner{minfo}: No contact" );
+        return undef;
+    }
+
+    if ( $? ne 0 ) {
+
+        # Bad exit code but we did talk to it so run with what we have.
+        target_error( $vp,
+            "Error running $confInner{minfo}: Bad exit code $?" );
+    }
+
      return @mq;
  }

@@ -5011,6 +5031,7 @@
      my ( $carg, $vp, $pid ) = @_;

      my @mq = fetch_mpi_queue( $carg, $vp, $pid );
+    return unless $mq[0];
      foreach my $o (@mq) {
          output( $vp, $o );
      }
@@ -5043,8 +5064,10 @@
          my $gdb = $proc->{gdb};

          my @mq = fetch_mpi_queue_gdb( $carg, $vp, $pid, $gdb );
-        foreach my $o (@mq) {
-            output( $vp, $o );
+        if ( $mq[0] ) {
+            foreach my $o (@mq) {
+                output( $vp, $o );
+            }
          }
      }





More information about the padb-devel mailing list