Changeset 473 in ProjectBuilder for devel/pb-modules
- Timestamp:
- Jun 4, 2008, 3:04:36 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb-modules/lib/ProjectBuilder/Base.pm
r471 r473 126 126 The first parameter is the shell command to call. 127 127 The second parameter is the message to print on screen. If none is given, then the command is printed. 128 The 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). 128 129 This function returns the result the return value of the system command. 129 130 … … 137 138 my $cmt=shift || $cmd; 138 139 my $verbose=shift || undef; 140 my $redir = ""; 139 141 140 142 pb_log(0,"$cmt... "); 141 143 pb_log(1,"Executing $cmd\n"); 142 system("$cmd 2>&1 > $ENV{'PBTMP'}/system.log"); 144 $redir = "2>&1 > $ENV{'PBTMP'}/system.log" if ((! defined $verbose) || ($verbose ne "noredir")); 145 system("$cmd $redir"); 143 146 my $res = $?; 144 147 if ($res == -1) { 145 148 pb_log(0,"failed to execute ($cmd): $!\n"); 146 pb_display_file("$ENV{'PBTMP'}/system.log") ;149 pb_display_file("$ENV{'PBTMP'}/system.log") if (-f "$ENV{'PBTMP'}/system.log"); 147 150 } elsif ($res & 127) { 148 151 pb_log(0, "child ($cmd) died with signal ".($? & 127).", ".($? & 128) ? 'with' : 'without'." coredump\n"); 149 pb_display_file("$ENV{'PBTMP'}/system.log") ;152 pb_display_file("$ENV{'PBTMP'}/system.log") if (-f "$ENV{'PBTMP'}/system.log"); 150 153 } elsif ($res == 0) { 151 154 pb_log(0,"OK\n"); 152 pb_display_file("$ENV{'PBTMP'}/system.log") if ( defined $verbose);155 pb_display_file("$ENV{'PBTMP'}/system.log") if ((defined $verbose) && (-f "$ENV{'PBTMP'}/system.log")); 153 156 } else { 154 157 pb_log(0, "child ($cmd) exited with value ".($? >> 8)."\n"); 155 pb_display_file("$ENV{'PBTMP'}/system.log") ;158 pb_display_file("$ENV{'PBTMP'}/system.log") if (-f "$ENV{'PBTMP'}/system.log"); 156 159 } 157 160 return($res);
Note:
See TracChangeset
for help on using the changeset viewer.