Changeset 43048
- Timestamp:
- Jun 1, 2026, 4:53:16 PM (7 weeks ago)
- Location:
- branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts
- Files:
-
- 11 edited
-
psmkreq (modified) (3 diffs)
-
pstamp_finish.pl (modified) (1 diff)
-
pstamp_job_run.pl (modified) (2 diffs)
-
pstamp_parser_run.pl (modified) (6 diffs)
-
pstamp_queue_cleanup.pl (modified) (3 diffs)
-
pstamp_queue_requests.pl (modified) (7 diffs)
-
pstamp_queue_update_cleanup.pl (modified) (4 diffs)
-
pstamp_save_server_status.pl (modified) (3 diffs)
-
pstamp_server_status (modified) (3 diffs)
-
pstamp_webrequest.pl (modified) (2 diffs)
-
pstampparse.pl (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/psmkreq
r40421 r43048 17 17 use File::Temp qw(tempfile); 18 18 use File::Basename qw(basename); 19 use Scalar::Util qw(looks_like_number); 19 20 use IPC::Cmd 0.36 qw( can_run run ); 20 21 use Carp; … … 295 296 my $command = "$pstamp_request_file --input $table_def_name --req_name $req_name"; 296 297 $command .= " --output $output" if $output; 297 my ( $success, $error_ code, $full_buf, $stdout_buf, $stderr_buf ) =298 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = 298 299 run(command => $command, verbose => $verbose); 300 my $error_code = &parse_error_message ($success, $error_msg, $command); 299 301 unless ($success) { 300 302 print STDERR @$stderr_buf; 301 exit $error_code >> 8;303 exit $error_code; 302 304 } 303 305 } … … 447 449 448 450 } 451 452 # if the program exited normally, the exit value is returned 453 # if the program exited with a signal (abort, crash, etc), PS_EXIT_PROG_ERROR (4) is returned 454 # if the program failed to run, -PS_EXIT_PROG_ERROR (-4) is returned 455 sub parse_error_message { 456 my $success = shift; 457 my $error_msg = shift; 458 my $command = shift; 459 460 if ($success) { return 0; } 461 462 print "raw error_msg: $error_msg\n"; 463 print "full command: $command\n"; 464 465 if (&looks_like_number($error_msg)) { return (($error_msg >> 8) or ($PS_EXIT_PROG_ERROR)); } 466 467 # which of these match? 468 my ($error_code) = $error_msg =~ m/exited with value (\d+)/; 469 if (defined $error_code) { return $error_code; } 470 471 ($error_code) = $error_msg =~ m/died with signal (\d+)/; 472 # if (defined $error_code) { return (128 + $error_code); } 473 if (defined $error_code) { return ($PS_EXIT_PROG_ERROR); } 474 475 # probably failed to execute: 476 return (-1*$PS_EXIT_PROG_ERROR); 477 } 478 -
branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_finish.pl
r43023 r43048 16 16 use File::Copy; 17 17 use File::Basename qw(dirname); 18 use Scalar::Util qw(looks_like_number); 18 19 19 20 use PS::IPP::Metadata::Config; -
branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_job_run.pl
r42981 r43048 15 15 use File::Copy; 16 16 use File::Temp qw(tempfile tempdir); 17 use Scalar::Util qw(looks_like_number); 18 17 19 use Digest::MD5::File qw( file_md5_hex ); 18 20 use PS::IPP::PStamp::RequestFile qw( :standard ); … … 946 948 } 947 949 950 951 # if the program exited normally, the exit value is returned 952 # if the program exited with a signal (abort, crash, etc), PS_EXIT_PROG_ERROR (4) is returned 953 # if the program failed to run, -PS_EXIT_PROG_ERROR (-4) is returned 954 sub parse_error_message { 955 my $success = shift; 956 my $error_msg = shift; 957 my $command = shift; 958 959 if ($success) { return 0; } 960 961 print "raw error_msg: $error_msg\n"; 962 print "full command: $command\n"; 963 964 if (&looks_like_number($error_msg)) { return (($error_msg >> 8) or ($PS_EXIT_PROG_ERROR)); } 965 966 # which of these match? 967 my ($error_code) = $error_msg =~ m/exited with value (\d+)/; 968 if (defined $error_code) { return $error_code; } 969 970 ($error_code) = $error_msg =~ m/died with signal (\d+)/; 971 # if (defined $error_code) { return (128 + $error_code); } 972 if (defined $error_code) { return ($PS_EXIT_PROG_ERROR); } 973 974 # probably failed to execute: 975 return (-1*$PS_EXIT_PROG_ERROR); 976 } -
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 -
branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_queue_cleanup.pl
r42981 r43048 10 10 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); 11 11 use Pod::Usage qw( pod2usage ); 12 use Scalar::Util qw(looks_like_number); 12 13 13 14 my $verbose; … … 69 70 70 71 my $command = "$pstamptool -updatereq -set_state goto_cleaned -state stop -timestamp_end $timestamp_end"; 71 my ( $success, $error_ code, $full_buf, $stdout_buf, $stderr_buf ) =72 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = 72 73 run(command => $command, verbose => $verbose); 74 my $error_code = &parse_error_message ($success, $error_msg, $command); 73 75 unless ($success) { 74 $error_code = ( ($error_code >> 8)or 1);76 $error_code = ($error_code or 1); 75 77 warn("$command failed. exit status: $error_code"); 76 78 exit $error_code; … … 79 81 80 82 exit 0; 83 84 # if the program exited normally, the exit value is returned 85 # if the program exited with a signal (abort, crash, etc), PS_EXIT_PROG_ERROR (4) is returned 86 # if the program failed to run, -PS_EXIT_PROG_ERROR (-4) is returned 87 sub parse_error_message { 88 my $success = shift; 89 my $error_msg = shift; 90 my $command = shift; 91 92 if ($success) { return 0; } 93 94 print "raw error_msg: $error_msg\n"; 95 print "full command: $command\n"; 96 97 if (&looks_like_number($error_msg)) { return (($error_msg >> 8) or ($PS_EXIT_PROG_ERROR)); } 98 99 # which of these match? 100 my ($error_code) = $error_msg =~ m/exited with value (\d+)/; 101 if (defined $error_code) { return $error_code; } 102 103 ($error_code) = $error_msg =~ m/died with signal (\d+)/; 104 # if (defined $error_code) { return (128 + $error_code); } 105 if (defined $error_code) { return ($PS_EXIT_PROG_ERROR); } 106 107 # probably failed to execute: 108 return (-1*$PS_EXIT_PROG_ERROR); 109 } -
branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_queue_requests.pl
r42981 r43048 11 11 12 12 use Getopt::Long qw( GetOptions ); 13 use Scalar::Util qw(looks_like_number); 13 14 14 15 use Sys::Hostname; … … 77 78 $command .= " -dbserver $dbserver" if $dbserver; 78 79 79 my ( $success, $error_ code, $full_buf, $stdout_buf, $stderr_buf ) =80 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = 80 81 run(command => $command, verbose => $verbose); 82 my $error_code = &parse_error_message ($success, $error_msg, $command); 81 83 unless ($success) { 82 my $rc = $error_code >> 8;84 my $rc = $error_code; 83 85 die("Unable to perform pstamptool -datastore: $rc"); 84 86 } … … 121 123 $command .= " --timeout $timeout"; 122 124 123 my ( $success, $error_ code, $full_buf, $stdout_buf, $stderr_buf ) =125 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = 124 126 run(command => $command, verbose => $verbose); 127 my $error_code = &parse_error_message ($success, $error_msg, $command); 125 128 unless ($success) { 126 129 # dsproductls exit status is the http error code - 300 127 my $exit_status = $error_code >> 8;130 my $exit_status = $error_code; 128 131 129 132 # don't die on "common faults" … … 167 170 { 168 171 my $command = "$dsfilesetls --uri $uri"; 169 my ( $success, $error_ code, $full_buf, $stdout_buf, $stderr_buf ) =172 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = 170 173 run(command => $command, verbose => $verbose); 174 my $error_code = &parse_error_message ($success, $error_msg, $command); 171 175 unless ($success) { 172 176 # we don't want to die here. We need to set lastFileset … … 197 201 $command .= " -dbserver $dbserver" if $dbserver; 198 202 199 my ( $success, $error_ code, $full_buf, $stdout_buf, $stderr_buf ) =203 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = 200 204 run(command => $command, verbose => $verbose); 205 my $error_code = &parse_error_message ($success, $error_msg, $command); 201 206 202 207 unless ($success) { … … 208 213 209 214 { 210 ## now update the last_fileset column in pstampDataStore 211 my $command = "$pstamptool -ds_id $ds_id -moddatastore -set_last_fileset $lastFileset"; 212 $command .= " -dbname $dbname" if $dbname; 213 $command .= " -dbserver $dbserver" if $dbserver; 214 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 215 run(command => $command, verbose => $verbose); 216 unless ($success) { 217 die("Unable to perform pstamptool -moddatastore: $error_code"); 218 } 215 ## now update the last_fileset column in pstampDataStore 216 my $command = "$pstamptool -ds_id $ds_id -moddatastore -set_last_fileset $lastFileset"; 217 $command .= " -dbname $dbname" if $dbname; 218 $command .= " -dbserver $dbserver" if $dbserver; 219 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = 220 run(command => $command, verbose => $verbose); 221 my $error_code = &parse_error_message ($success, $error_msg, $command); 222 unless ($success) { 223 die("Unable to perform pstamptool -moddatastore: $error_code"); 224 } 219 225 } 220 226 last if ($numFilesets >= $limit); … … 232 238 $command .= " -dbname $dbname" if $dbname; 233 239 $command .= " -dbserver $dbserver" if $dbserver; 234 my ( $success, $error_ code, $full_buf, $stdout_buf, $stderr_buf ) =240 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = 235 241 run(command => $command, verbose => $verbose); 242 my $error_code = &parse_error_message ($success, $error_msg, $command); 236 243 unless ($success) { 237 244 die("Unable to perform pstamptool -moddatastore: $error_code"); 238 245 } 239 246 } 247 248 # if the program exited normally, the exit value is returned 249 # if the program exited with a signal (abort, crash, etc), PS_EXIT_PROG_ERROR (4) is returned 250 # if the program failed to run, -PS_EXIT_PROG_ERROR (-4) is returned 251 sub parse_error_message { 252 my $success = shift; 253 my $error_msg = shift; 254 my $command = shift; 255 256 if ($success) { return 0; } 257 258 print "raw error_msg: $error_msg\n"; 259 print "full command: $command\n"; 260 261 if (&looks_like_number($error_msg)) { return (($error_msg >> 8) or ($PS_EXIT_PROG_ERROR)); } 262 263 # which of these match? 264 my ($error_code) = $error_msg =~ m/exited with value (\d+)/; 265 if (defined $error_code) { return $error_code; } 266 267 ($error_code) = $error_msg =~ m/died with signal (\d+)/; 268 # if (defined $error_code) { return (128 + $error_code); } 269 if (defined $error_code) { return ($PS_EXIT_PROG_ERROR); } 270 271 # probably failed to execute: 272 return (-1*$PS_EXIT_PROG_ERROR); 273 } -
branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_queue_update_cleanup.pl
r42981 r43048 10 10 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); 11 11 use Pod::Usage qw( pod2usage ); 12 use Scalar::Util qw(looks_like_number); 12 13 13 14 my $verbose; … … 66 67 67 68 my $command = "$pstamptool -pendingdependent -includefaulted -simple"; 68 my ( $success, $error_ code, $full_buf, $stdout_buf, $stderr_buf ) =69 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = 69 70 run(command => $command, verbose => $very_verbose); 71 my $error_code = &parse_error_message ($success, $error_msg, $command); 70 72 unless ($success) { 71 $error_code = ( ($error_code >> 8)or 1);73 $error_code = ($error_code or 1); 72 74 warn("$command failed. exit status: $error_code"); 73 75 exit $error_code; … … 86 88 $command .= " -dbname $imagedb"; 87 89 88 my ( $success, $error_ code, $full_buf, $stdout_buf, $stderr_buf ) =90 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = 89 91 run(command => $command, verbose => $very_verbose); 92 my $error_code = &parse_error_message ($success, $error_msg, $command); 90 93 unless ($success) { 91 $error_code = ( ($error_code >> 8)or 1);94 $error_code = ($error_code or 1); 92 95 warn("$command failed. exit status: $error_code"); 93 96 exit $error_code; … … 97 100 98 101 exit 0; 102 103 # if the program exited normally, the exit value is returned 104 # if the program exited with a signal (abort, crash, etc), PS_EXIT_PROG_ERROR (4) is returned 105 # if the program failed to run, -PS_EXIT_PROG_ERROR (-4) is returned 106 sub parse_error_message { 107 my $success = shift; 108 my $error_msg = shift; 109 my $command = shift; 110 111 if ($success) { return 0; } 112 113 print "raw error_msg: $error_msg\n"; 114 print "full command: $command\n"; 115 116 if (&looks_like_number($error_msg)) { return (($error_msg >> 8) or ($PS_EXIT_PROG_ERROR)); } 117 118 # which of these match? 119 my ($error_code) = $error_msg =~ m/exited with value (\d+)/; 120 if (defined $error_code) { return $error_code; } 121 122 ($error_code) = $error_msg =~ m/died with signal (\d+)/; 123 # if (defined $error_code) { return (128 + $error_code); } 124 if (defined $error_code) { return ($PS_EXIT_PROG_ERROR); } 125 126 # probably failed to execute: 127 return (-1*$PS_EXIT_PROG_ERROR); 128 } -
branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_save_server_status.pl
r42981 r43048 11 11 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); 12 12 use Pod::Usage qw( pod2usage ); 13 use Scalar::Util qw(looks_like_number); 13 14 14 15 my $updatelink; … … 63 64 my $command = "pstamp_server_status --workdir $pstamp_workdir > $file"; 64 65 #my $command = "pstamp_server_status > $file"; 65 my ( $success, $error_ code, $full_buf, $stdout_buf, $stderr_buf ) =66 my ( $success, $error_msgo, $full_buf, $stdout_buf, $stderr_buf ) = 66 67 run(command => $command, verbose => $verbose); 68 my $error_code = &parse_error_message ($success, $error_msg, $command); 67 69 unless ($success) { 68 $error_code = ( ($error_code >> 8)or 1);70 $error_code = ($error_code or 1); 69 71 warn("$command failed. exit status: $error_code"); 70 72 exit $error_code; … … 80 82 81 83 exit 0; 84 85 # if the program exited normally, the exit value is returned 86 # if the program exited with a signal (abort, crash, etc), PS_EXIT_PROG_ERROR (4) is returned 87 # if the program failed to run, -PS_EXIT_PROG_ERROR (-4) is returned 88 sub parse_error_message { 89 my $success = shift; 90 my $error_msg = shift; 91 my $command = shift; 92 93 if ($success) { return 0; } 94 95 print "raw error_msg: $error_msg\n"; 96 print "full command: $command\n"; 97 98 if (&looks_like_number($error_msg)) { return (($error_msg >> 8) or ($PS_EXIT_PROG_ERROR)); } 99 100 # which of these match? 101 my ($error_code) = $error_msg =~ m/exited with value (\d+)/; 102 if (defined $error_code) { return $error_code; } 103 104 ($error_code) = $error_msg =~ m/died with signal (\d+)/; 105 # if (defined $error_code) { return (128 + $error_code); } 106 if (defined $error_code) { return ($PS_EXIT_PROG_ERROR); } 107 108 # probably failed to execute: 109 return (-1*$PS_EXIT_PROG_ERROR); 110 } -
branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_server_status
r42983 r43048 13 13 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); 14 14 use Pod::Usage qw( pod2usage ); 15 15 use Scalar::Util qw(looks_like_number); 16 16 17 17 my ($rundir, $workdir, $verbose, $save_temps); … … 71 71 my $serverRunning = 0; 72 72 my $command = "$pantasks_client < $pantasks_script"; 73 my ( $success, $error_ code, $full_buf, $stdout_buf, $stderr_buf ) =73 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = 74 74 run(command => $command, verbose => $verbose); 75 my $error_code = &parse_error_message ($success, $error_msg, $command); 75 76 if ($success) { 76 77 $serverRunning = 1; 77 78 } else { 78 $error_code = ( ($error_code >> 8)or 1);79 $error_code = ($error_code or 1); 79 80 if ($error_code == 12 || $error_code == 13) { 80 81 print "Postage Stamp Server is not running\n<br>"; … … 205 206 206 207 exit 0; 208 209 # if the program exited normally, the exit value is returned 210 # if the program exited with a signal (abort, crash, etc), PS_EXIT_PROG_ERROR (4) is returned 211 # if the program failed to run, -PS_EXIT_PROG_ERROR (-4) is returned 212 sub parse_error_message { 213 my $success = shift; 214 my $error_msg = shift; 215 my $command = shift; 216 217 if ($success) { return 0; } 218 219 print "raw error_msg: $error_msg\n"; 220 print "full command: $command\n"; 221 222 if (&looks_like_number($error_msg)) { return (($error_msg >> 8) or ($PS_EXIT_PROG_ERROR)); } 223 224 # which of these match? 225 my ($error_code) = $error_msg =~ m/exited with value (\d+)/; 226 if (defined $error_code) { return $error_code; } 227 228 ($error_code) = $error_msg =~ m/died with signal (\d+)/; 229 # if (defined $error_code) { return (128 + $error_code); } 230 if (defined $error_code) { return ($PS_EXIT_PROG_ERROR); } 231 232 # probably failed to execute: 233 return (-1*$PS_EXIT_PROG_ERROR); 234 } -
branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_webrequest.pl
r42981 r43048 25 25 my $req_name_prefix = 'web'; 26 26 my $username; 27 28 my $DEBUG = 0; 27 29 28 30 GetOptions( … … 93 95 my $command = "$psmkreq --req_name $request_name --output $request_file @ARGV"; 94 96 95 if ( 0) {97 if ($DEBUG) { 96 98 open DEBUG, ">>/tmp/pstamp.debug.log"; 97 99 print DEBUG "\ncommand is: $command\n"; -
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.
