Changeset 43052 for branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_queue_update_cleanup.pl
- Timestamp:
- Jun 12, 2026, 2:47:49 PM (5 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_queue_update_cleanup.pl
r43048 r43052 6 6 use warnings; 7 7 8 use PS::IPP::Config 1.01 qw( :standard );9 use IPC::Cmd 0.36 qw( can_run run);8 use PS::IPP::Config 1.01 qw( :standard ps_run ); 9 use IPC::Cmd 0.36 qw( can_run ); 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);13 12 14 13 my $verbose; … … 67 66 68 67 my $command = "$pstamptool -pendingdependent -includefaulted -simple"; 69 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = 70 run(command => $command, verbose => $very_verbose); 71 my $error_code = &parse_error_message ($success, $error_msg, $command); 68 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 69 ps_run(command => $command, verbose => $very_verbose); 72 70 unless ($success) { 73 $error_code = ( $error_codeor 1);71 $error_code = (($error_code >> 8) or 1); 74 72 warn("$command failed. exit status: $error_code"); 75 73 exit $error_code; … … 88 86 $command .= " -dbname $imagedb"; 89 87 90 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = 91 run(command => $command, verbose => $very_verbose); 92 my $error_code = &parse_error_message ($success, $error_msg, $command); 88 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 89 ps_run(command => $command, verbose => $very_verbose); 93 90 unless ($success) { 94 $error_code = ( $error_codeor 1);91 $error_code = (($error_code >> 8) or 1); 95 92 warn("$command failed. exit status: $error_code"); 96 93 exit $error_code; … … 101 98 exit 0; 102 99 103 # if the program exited normally, the exit value is returned104 # if the program exited with a signal (abort, crash, etc), PS_EXIT_PROG_ERROR (4) is returned105 # if the program failed to run, -PS_EXIT_PROG_ERROR (-4) is returned106 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 }
Note:
See TracChangeset
for help on using the changeset viewer.
