- Timestamp:
- Jun 1, 2026, 4:53:16 PM (7 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_parser_run.pl
r42981 r43048 13 13 use Getopt::Long qw( GetOptions ); 14 14 use File::Basename qw( basename dirname); 15 use Scalar::Util qw(looks_like_number); 15 16 use File::Copy; 16 17 use POSIX qw( strftime ); … … 128 129 # if the uri is an http uri download the file 129 130 my $command = "$dsget --uri $uri --filename $new_uri --timeout 120"; 130 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 131 run(command => $command, verbose => $verbose); 131 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = 132 run(command => $command, verbose => $verbose); 133 my $error_code = &parse_error_message ($success, $error_msg, $command); 132 134 unless ($success) { 133 my_die("Unable to perform $command error code: $error_code", $req_id, $error_code >> 8);135 my_die("Unable to perform $command error code: $error_code", $req_id, $error_code); 134 136 } 135 137 } elsif ($uri ne $new_uri) { … … 204 206 $command .= " -dbname $dbname" if $dbname; 205 207 $command .= " -dbserver $dbserver" if $dbserver; 206 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 207 run(command => $command, verbose => $verbose); 208 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = 209 run(command => $command, verbose => $verbose); 210 my $error_code = &parse_error_message ($success, $error_msg, $command); 208 211 unless ($success) { 209 212 die("Unable to perform $command error code: $error_code"); … … 227 230 228 231 my $command = "$parse_cmd"; 229 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 230 run(command => $command, verbose => $verbose); 232 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = 233 run(command => $command, verbose => $verbose); 234 my $error_code = &parse_error_message ($success, $error_msg, $command); 231 235 232 236 # save the contents of stderr (if any) to a file. This is relevant if … … 254 258 } 255 259 } else { 256 $fault = $error_code >> 8;260 $fault = $error_code; 257 261 } 258 262 } … … 326 330 exit $fault; 327 331 } 332 333 # if the program exited normally, the exit value is returned 334 # if the program exited with a signal (abort, crash, etc), PS_EXIT_PROG_ERROR (4) is returned 335 # if the program failed to run, -PS_EXIT_PROG_ERROR (-4) is returned 336 sub parse_error_message { 337 my $success = shift; 338 my $error_msg = shift; 339 my $command = shift; 340 341 if ($success) { return 0; } 342 343 print "raw error_msg: $error_msg\n"; 344 print "full command: $command\n"; 345 346 if (&looks_like_number($error_msg)) { return (($error_msg >> 8) or ($PS_EXIT_PROG_ERROR)); } 347 348 # which of these match? 349 my ($error_code) = $error_msg =~ m/exited with value (\d+)/; 350 if (defined $error_code) { return $error_code; } 351 352 ($error_code) = $error_msg =~ m/died with signal (\d+)/; 353 # if (defined $error_code) { return (128 + $error_code); } 354 if (defined $error_code) { return ($PS_EXIT_PROG_ERROR); } 355 356 # probably failed to execute: 357 return (-1*$PS_EXIT_PROG_ERROR); 358 } 359
Note:
See TracChangeset
for help on using the changeset viewer.
