Changeset 347

Show
Ignore:
Timestamp:
12/10/06 12:57:35 (6 years ago)
Author:
max
Message:

Tidy output, to make it a little clearer when output comes from a component

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • applications/shepherd

    r345 r347  
    490490    if ($result) 
    491491    { 
    492         &log("\n" . ucfirst($progtype) . " $proggy did not exit cleanly!\n" . 
     492        &log(ucfirst($progtype) . " $proggy did not exit cleanly!\n" . 
    493493             "It may require configuration.\n"); 
    494494 
     
    873873 
    874874    if (!(open(PROG,"$prog|"))) { 
    875         &log("warning: couldn't exec \"$prog\": $!\n"); 
     875        &log("warning: couldn't exec $component as \"$prog\": $!\n"); 
    876876        return -1; 
    877877    } 
     878 
     879    &log("\n>>>> Output from $component >>>>>\n"); 
    878880 
    879881    eval { 
     
    891893        close(PROG); 
    892894    }; 
     895 
     896    &log("<<<<< End output from $component <<<<<\n\n"); 
     897 
    893898    if ($@) { 
    894899        die unless $@ eq "alarm\n";   # propagate unexpected errors 
    895900 
    896901        # timeout 
    897         &log("prog ran for $timeout seconds, stopping it.\n"); 
     902        &log(ucfirst($component) . " ran for $timeout seconds, stopping it.\n"); 
    898903        close(PROG); 
    899904    } 
    900905 
    901906    if ($? == -1) { 
    902         &log("Failed to execute prog: $!\n"); 
     907        &log("Failed to execute $component: $!\n"); 
    903908        return -1; 
    904909    } elsif ($? & 127) { 
    905         &log((sprintf "prog died with signal %d, %s coredump\n", 
    906           ($? & 127),  (($? & 128) ? "with" : "without"))); 
     910        &log((sprintf "%s died with signal %d, %s coredump\n", 
     911          ucfirst($component), ($? & 127),  (($? & 128) ? "with" : "without"))); 
    907912        return $?; 
    908     } else { 
    909         &log((sprintf "prog exited with value %d\n", ($? >> 8))); 
    910         return ($? >> 8); 
    911     } 
     913    } elsif ($debug) { 
     914        &log((sprintf "%s exited with value %d\n", ucfirst($component), ($? >> 8))); 
     915    } 
     916    return ($? >> 8); 
    912917} 
    913918