- Timestamp:
- Jun 1, 2026, 4:53:16 PM (2 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstampparse.pl
r42981 r43048 15 15 use File::Temp qw(tempfile); 16 16 use File::Basename qw(basename); 17 use Scalar::Util qw(looks_like_number); 17 18 use Carp; 18 19 use POSIX; … … 126 127 { 127 128 my $command = "echo $request_file_name | $fields -x 0 EXTNAME EXTVER REQ_NAME ACTION EMAIL"; 128 my ( $success, $error_ code, $full_buf, $stdout_buf, $stderr_buf ) =129 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = 129 130 run(command => $command, verbose => $verbose); 131 my $error_code = &parse_error_message ($success, $error_msg, $command); 130 132 131 133 # note fields doesn't return zero when it succeeds. … … 184 186 my $command = "$pstamptool -listreq -name $req_name -not_req_id $req_id"; 185 187 # no verbose so that error message about request not found doesn't appear in parse_error.txt 186 my ( $success, $error_ code, $full_buf, $stdout_buf, $stderr_buf ) =188 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = 187 189 run(command => $command, verbose => 0); 188 my $exitStatus = $error_code >> 8; 190 my $error_code = &parse_error_message ($success, $error_msg, $command); 191 my $exitStatus = $error_code; 189 192 if ($success) { 190 193 # -listreq succeeded there is already a request in the database with this name … … 781 784 782 785 my $base = basename($image->{image}); 783 if (! $base =~ /.fits$/) {786 if (! ($base =~ /.fits$/) ) { 784 787 my_die("unexpected image file name found $image->{image}", $PS_EXIT_PROG_ERROR); 785 788 } … … 1136 1139 1137 1140 if (!$no_update) { 1138 my ( $success, $error_ code, $full_buf, $stdout_buf, $stderr_buf ) =1141 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = 1139 1142 run(command => $command, verbose => $verbose); 1143 my $error_code = &parse_error_message ($success, $error_msg, $command); 1140 1144 unless ($success) { 1141 my $fault = $error_code >> 8;1145 my $fault = $error_code; 1142 1146 print STDERR "$command failed with fault $fault\n"; 1143 1147 if ($fault < $PSTAMP_FIRST_ERROR_CODE) { … … 1421 1425 exit $fault; 1422 1426 } 1427 1428 # if the program exited normally, the exit value is returned 1429 # if the program exited with a signal (abort, crash, etc), PS_EXIT_PROG_ERROR (4) is returned 1430 # if the program failed to run, -PS_EXIT_PROG_ERROR (-4) is returned 1431 sub parse_error_message { 1432 my $success = shift; 1433 my $error_msg = shift; 1434 my $command = shift; 1435 1436 if ($success) { return 0; } 1437 1438 print "raw error_msg: $error_msg\n"; 1439 print "full command: $command\n"; 1440 1441 if (&looks_like_number($error_msg)) { return (($error_msg >> 8) or ($PS_EXIT_PROG_ERROR)); } 1442 1443 # which of these match? 1444 my ($error_code) = $error_msg =~ m/exited with value (\d+)/; 1445 if (defined $error_code) { return $error_code; } 1446 1447 ($error_code) = $error_msg =~ m/died with signal (\d+)/; 1448 # if (defined $error_code) { return (128 + $error_code); } 1449 if (defined $error_code) { return ($PS_EXIT_PROG_ERROR); } 1450 1451 # probably failed to execute: 1452 return (-1*$PS_EXIT_PROG_ERROR); 1453 } 1454
Note:
See TracChangeset
for help on using the changeset viewer.
