Changeset 1513


Ignore:
Timestamp:
May 10, 2012, 12:47:44 PM (7 years ago)
Author:
bruno
Message:

r4758@localhost: bruno | 2012-05-10 10:49:36 +0200
Base.pm: Add a parameter to pb_system that allows commands to fail even if pb_stop_on_error is set. Some callers handle the error code. Add in pid to the error output from pb_system for help in tracking down which parent ran the command.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb-modules/lib/ProjectBuilder/Base.pm

    r1506 r1513  
    136136The second parameter is the message to print on screen. If none is given, then the command is printed.
    137137The third parameter print the result of the command after correct execution if value is verbose. If value is noredir, it avoids redirecting outputs (e.g. for vi). If value is quiet, doesn't print anything at all.
     138The fourth parameter determines whether failure of the command is ok even if $Global::pb_stop_on_error is set, because the caller will be handling the error.
    138139This function returns as a result the return value of the system command.
    139140
     
    147148my $cmt=shift || $cmd;
    148149my $verbose=shift || undef;
     150my $failure_ok = shift || 0;
    149151my $redir = "";
    150152
     
    175177    pb_log(0, $error) if ((! defined $verbose) || ($verbose ne "quiet")) || $Global::pb_stop_on_error;
    176178    pb_display_file("$ENV{'PBTMP'}/system.$$.log") if ((-f "$ENV{'PBTMP'}/system.$$.log") and ((! defined $verbose) || ($verbose ne "quiet") || $Global::pb_stop_on_error));
    177     if ($Global::pb_stop_on_error) {
    178         cluck "error running command ($cmd) with cwd=$cwd";
     179    if (($Global::pb_stop_on_error) && (! $failure_ok)) {
     180        cluck "error running command ($cmd) with cwd=$cwd, pid=$$";
    179181        exit(1);
    180182    }
Note: See TracChangeset for help on using the changeset viewer.