IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 43052


Ignore:
Timestamp:
Jun 12, 2026, 2:47:49 PM (5 weeks ago)
Author:
eugene
Message:

convert the IPC::Cmd run calls to ps_run to handle inconsistent behavior between IPC:Cmd versions pre- and post-0.40

Location:
branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts
Files:
25 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/detect_query_read

    r41440 r43052  
    2020use Math::Trig;
    2121use Data::Dumper;
    22 use IPC::Cmd 0.36 qw( can_run run );
     22use IPC::Cmd 0.36 qw( can_run );
     23use PS::IPP::Config qw( :standard ps_run );
    2324
    2425use constant EXTNAME => 'MOPS_DETECTABILITY_QUERY'; # Extension name for table
     
    195196            my $cmd = "$regtool -processedexp -dbname $dbname -exp_name $colData{FPA_ID}[$i]";
    196197            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    197                 run(command => $cmd, verbose => 0);
     198                ps_run(command => $cmd, verbose => 0);
    198199            unless ($success) {
    199200                # This is a problem, because I'm not sure how we handle a failure to read something.
     
    267268        }
    268269        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    269             run(command => $cmd, verbose => 1);
     270            ps_run(command => $cmd, verbose => 1);
    270271        unless ($success) {
    271272            # This is a problem, because I'm not sure how we handle a failure to read something.
  • branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/detectability_respond.pl

    r33283 r43052  
    1313use File::Basename;
    1414use File::Copy;
    15 use IPC::Cmd 0.36 qw( can_run run );
     15use IPC::Cmd 0.36 qw( can_run );
    1616use Getopt::Long qw( GetOptions );
    1717use Pod::Usage qw( pod2usage );
     
    2020use PS::IPP::PStamp::RequestFile qw( :standard );
    2121use PS::IPP::PStamp::Job qw( :standard );
    22 use PS::IPP::Config qw( :standard );
     22use PS::IPP::Config qw( :standard ps_run );
    2323use PS::IPP::Metadata::List qw( parse_md_list );
    2424
     
    108108    my $dqr_command = "$detect_query_read --dbname $imagedb --input $request_file";
    109109    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    110         run(command => $dqr_command, verbose => $verbose);
     110        ps_run(command => $dqr_command, verbose => $verbose);
    111111    unless ($success) {
    112112        # This is a problem, because I'm not sure how we handle a failure to read something.
     
    433433        my $command = "ppCoord -astrom $catalog -radec $coordname";
    434434        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    435             run(command => $command, verbose => $verbose);
     435            ps_run(command => $command, verbose => $verbose);
    436436        unless ($success) {
    437437            my_die("Unable to perform $command. Error_code: $error_code",
     
    473473       
    474474        ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    475             run(command => $psphot_cmd, verbose => $verbose);
     475            ps_run(command => $psphot_cmd, verbose => $verbose);
    476476        unless ($success) {
    477477            $query{$fpa_id}{PROC_ERROR}[$index] = $PSTAMP_SYSTEM_ERROR;
     
    828828
    829829    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    830         run(command => $command, verbose => $verbose);
     830        ps_run(command => $command, verbose => $verbose);
    831831    unless ($success) {
    832832        my $rc = $error_code >> 8;
  • branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/dquery_finish.pl

    r42981 r43052  
    1010
    1111use Sys::Hostname;
    12 use IPC::Cmd 0.36 qw( can_run run );
     12use IPC::Cmd 0.36 qw( can_run );
    1313use File::Temp qw( tempfile );
    1414use File::Copy;
     
    2020use PS::IPP::Metadata::List qw( parse_md_list );
    2121
    22 use PS::IPP::Config qw( :standard );
     22use PS::IPP::Config qw( :standard ps_run );
    2323
    2424my ( $req_id, $req_name, $req_file, $product, $outdir, $dbname, $dbserver, $verbose, $save_temps );
     
    9595    $command .= " -dbserver $dbserver" if $dbserver;
    9696    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    97         run(command => $command, verbose => $verbose);
     97        ps_run(command => $command, verbose => $verbose);
    9898    unless ($success) {
    9999        die("Unable to perform $command error code: $error_code");
     
    160160
    161161    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    162         run(command => $command, verbose => $verbose);
     162        ps_run(command => $command, verbose => $verbose);
    163163    unless ($success) {
    164164        $request_fault = $error_code >> 8;
     
    388388    $command   .= " -dbserver $dbserver" if $dbserver;
    389389    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    390         run(command => $command, verbose => $verbose);
     390        ps_run(command => $command, verbose => $verbose);
    391391    unless ($success) {
    392392        die("Unable to perform $command error code: $error_code");
  • branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/dquery_job_run.pl

    r41584 r43052  
    1313use File::Basename;
    1414use File::Copy;
    15 use IPC::Cmd 0.36 qw( can_run run );
     15use IPC::Cmd 0.36 qw( can_run );
    1616use Getopt::Long qw( GetOptions );
    1717use Pod::Usage qw( pod2usage );
     
    2020use PS::IPP::PStamp::RequestFile qw( :standard );
    2121use PS::IPP::PStamp::Job qw( :standard );
    22 use PS::IPP::Config qw( :standard );
     22use PS::IPP::Config qw( :standard ps_run );
    2323use PS::IPP::Metadata::List qw( parse_md_list );
    2424
     
    120120my $command = "ppCoord -astrom $catalog -radec $coordname";
    121121my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    122     run(command => $command, verbose => $verbose);
     122    ps_run(command => $command, verbose => $verbose);
    123123## MEH need to adjust error_code to rc
    124124unless ($success) {
     
    162162
    163163( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    164     run(command => $psphot_cmd, verbose => $verbose);
     164    ps_run(command => $psphot_cmd, verbose => $verbose);
    165165unless ($success) {
    166166    # $params->{PROC_ERROR} = $PSTAMP_SYSTEM_ERROR;
     
    339339
    340340    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    341         run(command => $command, verbose => $verbose);
     341        ps_run(command => $command, verbose => $verbose);
    342342    unless ($success) {
    343343        my $rc = $error_code >> 8;
  • branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/dqueryparse.pl

    r42042 r43052  
    1313use File::Basename;
    1414use File::Copy;
    15 use IPC::Cmd 0.36 qw( can_run run );
     15use IPC::Cmd 0.36 qw( can_run );
    1616use Getopt::Long qw( GetOptions );
    1717use Pod::Usage qw( pod2usage );
     
    2121use PS::IPP::PStamp::RequestFile qw( :standard );
    2222use PS::IPP::PStamp::Job qw( :standard );
    23 use PS::IPP::Config qw( :standard );
     23use PS::IPP::Config qw( :standard ps_run );
    2424use PS::IPP::Metadata::List qw( parse_md_list );
    2525
     
    8888    my $command = "echo $request_file | $fields -x 0 EXTNAME EXTVER QUERY_ID";
    8989    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    90         run(command => $command, verbose => $verbose);
     90        ps_run(command => $command, verbose => $verbose);
    9191   
    9292    $fields_output = join "", @$stdout_buf;
     
    105105    # set verbose to false so that error message about request not found doesn't appear in parse_error.txt
    106106    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    107         run(command => $command, verbose => 0);
     107        ps_run(command => $command, verbose => 0);
    108108    if ($success) {
    109109        # -listreq succeeded duplicate request name
     
    112112        unless ($no_update) {
    113113            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    114                 run(command => $command, verbose => $verbose);
     114                ps_run(command => $command, verbose => $verbose);
    115115            if (!$success) {
    116116                my_die("$command failed", $PS_EXIT_UNKNOWN_ERROR);
     
    126126    unless ($no_update) {
    127127        ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    128             run(command => $command, verbose => $verbose);
     128            ps_run(command => $command, verbose => $verbose);
    129129        unless ($success) {
    130130            my_die("$command failed", $PS_EXIT_UNKNOWN_ERROR);
     
    151151    my $dqr_command = "$detect_query_read --dbname $imagedb --input $request_file";
    152152    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    153         run(command => $dqr_command, verbose => $verbose);
     153        ps_run(command => $dqr_command, verbose => $verbose);
    154154    unless ($success) {
    155155        # This is a problem, because I'm not sure how we handle a failure to read something.
     
    489489        unless ($no_update) {
    490490            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    491                 run(command => $command, verbose => $verbose);
     491                ps_run(command => $command, verbose => $verbose);
    492492            if ($success) {
    493493                my $job_id = join "", @$stdout_buf;
     
    513513    unless ($no_update) {
    514514        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    515             run(command => $command, verbose => $verbose);
     515            ps_run(command => $command, verbose => $verbose);
    516516        if ($success) {
    517517            my $job_id = join "", @$stdout_buf;
     
    534534    unless ($no_update) {
    535535        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    536             run(command => $command, verbose => $verbose);
     536            ps_run(command => $command, verbose => $verbose);
    537537        unless ($success) {
    538538        my_die("$command failed",$PS_EXIT_UNKNOWN_ERROR);
     
    564564    if (!$no_update) {
    565565        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    566             run(command => $command, verbose => $verbose);
     566            ps_run(command => $command, verbose => $verbose);
    567567        unless ($success) {
    568568            my_die("$command failed", $PS_EXIT_UNKNOWN_ERROR);
  • branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/psgetcalibinfo

    r42983 r43052  
    1010use Carp;
    1111
    12 use IPC::Cmd 0.36 qw( can_run run );
     12use IPC::Cmd 0.36 qw( can_run );
    1313#use File::Temp qw( tempfile );
    1414#use File::Copy;
     
    1919use PS::IPP::Metadata::List qw( parse_md_list );
    2020
    21 use PS::IPP::Config qw( :standard );
     21use PS::IPP::Config qw( :standard ps_run );
    2222#use PS::IPP::PStamp::RequestFile qw( :standard );
    2323#use PS::IPP::PStamp::Job qw( :standard );
     
    5555    $command   .= " -dbname $dbname" if $dbname;
    5656    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    57         run(command => $command, verbose => $verbose);
     57        ps_run(command => $command, verbose => $verbose);
    5858    unless ($success) {
    5959        die("Unable to perform $command error code: $error_code");
  • branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/psmkreq

    r43048 r43052  
    1212use Getopt::Long qw( GetOptions ) ; # :config auto_help auto_version gnu_getopt );
    1313use Pod::Usage qw( pod2usage );
    14 use PS::IPP::Config qw( :standard );
     14use PS::IPP::Config qw( :standard ps_run );
    1515use PS::IPP::PStamp::RequestFile qw( :standard );
    1616use PS::IPP::PStamp::Job qw( :standard );
    1717use File::Temp qw(tempfile);
    1818use File::Basename qw(basename);
    19 use Scalar::Util qw(looks_like_number);
    20 use IPC::Cmd 0.36 qw( can_run run );
     19use IPC::Cmd 0.36 qw( can_run );
    2120use Carp;
    2221use POSIX;
     
    296295    my $command = "$pstamp_request_file --input $table_def_name --req_name $req_name";
    297296    $command .= " --output $output" if $output;
    298     my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) =
    299         run(command => $command, verbose => $verbose);
    300     my $error_code = &parse_error_message ($success, $error_msg, $command);
     297    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     298        ps_run(command => $command, verbose => $verbose);
    301299    unless ($success) {
    302300        print STDERR @$stderr_buf;
    303         exit $error_code;
     301        exit $error_code >>8;
    304302    }
    305303}
     
    450448}
    451449
    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_checkdependent.pl

    r42981 r43052  
    1515use Carp;
    1616use POSIX;
    17 use IPC::Cmd 0.36 qw( can_run run );
     17use IPC::Cmd 0.36 qw( can_run );
    1818use PS::IPP::Metadata::List qw( parse_md_list );
    19 use PS::IPP::Config qw( :standard );
     19use PS::IPP::Config qw( :standard ps_run );
    2020use PS::IPP::PStamp::RequestFile qw( :standard );
    2121use Carp;
     
    156156    if (!$no_update) {
    157157        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    158                     run(command => $command, verbose => $verbose);
     158                    ps_run(command => $command, verbose => $verbose);
    159159        unless ($success) {
    160160            my_die("failed to set pstampDependent.state to 'full' dep_id: $dep_id",
     
    312312                if (!$no_update) {
    313313                    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    314                                 run(command => $command, verbose => $verbose);
     314                                ps_run(command => $command, verbose => $verbose);
    315315                    unless ($success) {
    316316                        my_die("failed to change ${stage}Run $stage_id $component from goto_cleaned to update", $PS_EXIT_UNKNOWN_ERROR);
     
    343343            if (!$no_update) {
    344344                my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    345                             run(command => $command, verbose => $verbose);
     345                            ps_run(command => $command, verbose => $verbose);
    346346                unless ($success) {
    347347                    my_die("failed to queue ${stage}Run $stage_id $component for update", $PS_EXIT_UNKNOWN_ERROR);
     
    360360            if (!$no_update) {
    361361                my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    362                             run(command => $command, verbose => $verbose);
     362                            ps_run(command => $command, verbose => $verbose);
    363363                unless ($success) {
    364364                    my_die("failed to change ${stage}Run $stage_id $component from goto_cleaned to update", $PS_EXIT_UNKNOWN_ERROR);
     
    453453        if (!$no_update) {
    454454            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    455                         run(command => $command, verbose => $verbose);
     455                        ps_run(command => $command, verbose => $verbose);
    456456            unless ($success) {
    457457                my_die("failed to change state of ${stage}Run $stage_id from goto_cleaned to update", $PS_EXIT_UNKNOWN_ERROR);
     
    525525        if (!$no_update) {
    526526            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    527                         run(command => $command, verbose => $verbose);
     527                        ps_run(command => $command, verbose => $verbose);
    528528            unless ($success) {
    529529                my_die("failed to queue ${stage}Run $stage_id $component for update", $PS_EXIT_UNKNOWN_ERROR);
     
    539539        if (!$no_update) {
    540540            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    541                         run(command => $command, verbose => $verbose);
     541                        ps_run(command => $command, verbose => $verbose);
    542542            unless ($success) {
    543543                my_die("failed to change state of ${stage}Run $stage_id to update", $PS_EXIT_UNKNOWN_ERROR);
     
    582582        if (!$no_update) {
    583583            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    584                         run(command => $command, verbose => $verbose);
     584                        ps_run(command => $command, verbose => $verbose);
    585585            unless ($success) {
    586586                my_die("failed to queue ${stage}Run $stage_id $component for update", $PS_EXIT_UNKNOWN_ERROR);
     
    724724        if (!$no_update) {
    725725            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    726                         run(command => $command, verbose => $verbose);
     726                        ps_run(command => $command, verbose => $verbose);
    727727            unless ($success) {
    728728                my_die("failed to queue ${stage}Run $stage_id $component for update", $PS_EXIT_UNKNOWN_ERROR);
     
    737737        if (!$no_update) {
    738738            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    739                         run(command => $command, verbose => $verbose);
     739                        ps_run(command => $command, verbose => $verbose);
    740740            unless ($success) {
    741741                my_die("failed to queue ${stage}Run $stage_id $component for update", $PS_EXIT_UNKNOWN_ERROR);
     
    765765    # run the command and parse the output
    766766    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    767                 run(command => $command, verbose => $verbose);
     767                ps_run(command => $command, verbose => $verbose);
    768768    unless ($success) {
    769769        print STDERR @$stderr_buf if !$verbose;
     
    904904                    if (!$no_update) {
    905905                        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    906                             run(command => $command, verbose => $verbose);
     906                            ps_run(command => $command, verbose => $verbose);
    907907                        unless ($success) {
    908908                            my_die("failed to set destreaked component to 'update' for ${stage}Run $stage_id $c",
     
    936936    if (!$no_update) {
    937937        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    938                     run(command => $command, verbose => $verbose);
     938                    ps_run(command => $command, verbose => $verbose);
    939939        unless ($success) {
    940940            my_die("failed to set pstampJob.fault for dep_id: $dep_id",
     
    970970    if (!$no_update) {
    971971        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    972                     run(command => $command, verbose => $verbose);
     972                    ps_run(command => $command, verbose => $verbose);
    973973        unless ($success) {
    974974            carp "$cmd failed";
     
    988988    if (!$no_update) {
    989989        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    990                     run(command => $command, verbose => $verbose);
     990                    ps_run(command => $command, verbose => $verbose);
    991991        unless ($success) {
    992992            carp "$cmd failed";
  • branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_cleanup.pl

    r42981 r43052  
    1616use POSIX qw( strftime );
    1717use Carp;
    18 use IPC::Cmd 0.36 qw( can_run run );
     18use IPC::Cmd 0.36 qw( can_run );
    1919
    2020use PS::IPP::Metadata::Config;
     
    2222use PS::IPP::Metadata::List qw( parse_md_list );
    2323
    24 use PS::IPP::Config qw( :standard );
     24use PS::IPP::Config qw( :standard ps_run );
    2525use PS::IPP::PStamp::Job qw( :standard );
    2626
     
    9191
    9292    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    93         run(command => $command, verbose => $verbose);
     93        ps_run(command => $command, verbose => $verbose);
    9494    unless ($success) {
    9595        my_die("Unable to perform $command error code: $error_code", $req_id, $PS_EXIT_UNKNOWN_ERROR);
     
    102102    $command   .= " -dbserver $dbserver" if $dbserver;
    103103    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    104         run(command => $command, verbose => $verbose);
     104        ps_run(command => $command, verbose => $verbose);
    105105    unless ($success) {
    106106        die("Unable to perform $command error code: $error_code");
     
    136136        my $command = "find $pstamp_workdir -maxdepth 2 -type d -name $req_id";
    137137        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    138             run(command => $command, verbose => $verbose);
     138            ps_run(command => $command, verbose => $verbose);
    139139        unless ($success) {
    140140            my $rc = $error_code >> 8;
     
    161161    unless ($no_update) {
    162162        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    163             run(command => $command, verbose => $verbose);
     163            ps_run(command => $command, verbose => $verbose);
    164164        unless ($success) {
    165165            die("Unable to perform $command error code: $error_code");
     
    192192    unless ($no_update) {
    193193        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    194             run(command => $command, verbose => $verbose);
     194            ps_run(command => $command, verbose => $verbose);
    195195        unless ($success) {
    196196            if (-e $dir) {
     
    219219    unless ($no_update) {
    220220        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    221             run(command => $command, verbose => $verbose);
     221            ps_run(command => $command, verbose => $verbose);
    222222        unless ($success) {
    223223            die("Unable to perform $command error code: $error_code");
  • branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_dorequest.pl

    r42981 r43052  
    2828}
    2929
    30 use IPC::Cmd 0.36 qw( can_run run );
     30use IPC::Cmd 0.36 qw( can_run );
    3131
    3232use PS::IPP::Metadata::Config;
     
    4444                       metadataLookupBool
    4545                       caturi
     46                       ps_run
    4647                       );
    4748
     
    6364    my $command = "$pstamptool -pendingjob";
    6465    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    65         run(command => $command, verbose => $verbosity);
     66        ps_run(command => $command, verbose => $verbosity);
    6667    unless ($success) {
    6768        die("Unable to perform pstamptool -pendingreq: $error_code");
     
    9495    my $command = "$ppstamp_run $job->{job_id}";
    9596    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    96         run(command => $command, verbose => $verbosity);
     97        ps_run(command => $command, verbose => $verbosity);
    9798    unless ($success) {
    9899        die("Unable to perform $command: $error_code");
     
    108109    my $command = "$pstamptool -updatereq -req_id $request_id -set_state stop";
    109110    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    110         run(command => $command, verbose => $verbosity);
     111        ps_run(command => $command, verbose => $verbosity);
    111112    unless ($success) {
    112113        die("Unable to perform pstamptool -updatereq: $error_code");
  • branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_finish.pl

    r43048 r43052  
    1212use Time::Local;
    1313use Sys::Hostname;
    14 use IPC::Cmd 0.36 qw( can_run run );
     14use IPC::Cmd 0.36 qw( can_run );
    1515use File::Temp qw( tempfile );
    1616use File::Copy;
    1717use File::Basename qw(dirname);
    18 use Scalar::Util qw(looks_like_number);
    1918
    2019use PS::IPP::Metadata::Config;
     
    2221use PS::IPP::Metadata::List qw( parse_md_list );
    2322
    24 use PS::IPP::Config qw( :standard );
     23use PS::IPP::Config qw( :standard ps_run );
    2524use PS::IPP::PStamp::RequestFile qw( :standard );
    2625use PS::IPP::PStamp::Job qw( :standard );
     
    138137            $command   .= " -dbname $dbname" if $dbname;
    139138            $command   .= " -dbserver $dbserver" if $dbserver;
    140             my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose);
    141             my $error_code = &parse_error_message ($success, $error_msg, $command);
     139            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = ps_run($command, $verbose);
    142140            unless ($success) {
    143                 die("Unable to perform $command error code: $error_code");
     141                my $rc = $error_code >> 8;
     142                die("Unable to perform $command error code: $rc ($error_code)");
    144143            }
    145144            my $output = join "", @$stdout_buf;
     
    261260        {
    262261            my $command = "$pstamp_results --input $table_def_name --output $outdir/results.fits";
    263             my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose);
    264             my $error_code = &parse_error_message ($success, $error_msg, $command);
     262            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = ps_run(command => $command, verbose => $verbose);
    265263            unless ($success) {
    266264                print STDERR "Unable to perform $command error code: $error_code\n";
    267                 $request_fault = $error_code;
     265                $request_fault = $error_code >> 8;
    268266            } else {
    269267                # dump a textual representation
    270268                my $command = "$pstampdump $outdir/results.fits > $outdir/results.mdc";
    271269                my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    272                     run(command => $command, verbose => $verbose);
     270                    ps_run(command => $command, verbose => $verbose);
    273271                unless ($success) {
    274                     $request_fault = $error_code;
     272                    $request_fault = $error_code >> 8;
    275273                    my_die("Unable to perform $command error code: $error_code", $req_id, $request_fault);
    276274                }
     
    287285
    288286        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    289             run(command => $command, verbose => $verbose);
     287            ps_run(command => $command, verbose => $verbose);
    290288        unless ($success) {
    291             $request_fault = $error_code;
     289            $request_fault = $error_code >> 8;
    292290            my_die("Unable to perform $command error code: $error_code\n", $req_id, $request_fault);
    293291        }
     
    299297        $command   .= " -dbserver $dbserver" if $dbserver;
    300298        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    301             run(command => $command, verbose => $verbose);
     299            ps_run(command => $command, verbose => $verbose);
    302300        unless ($success) {
    303301            die("Unable to perform $command error code: $error_code");
     
    319317
    320318    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    321         run(command => $command, verbose => $verbose);
     319        ps_run(command => $command, verbose => $verbose);
    322320    unless ($success) {
    323321        die("Unable to perform $command error code: $error_code");
     
    435433            # run the tool and parse the output
    436434            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    437                         run(command => $command, verbose => $verbose);
     435                        ps_run(command => $command, verbose => $verbose);
    438436            unless ($success) {
    439437                # not sure if we should die here
     
    506504    return 40587.0 + ($ticks/86400.);
    507505}
    508 
    509 # if the program exited normally, the exit value is returned
    510 # if the program exited with a signal (abort, crash, etc), PS_EXIT_PROG_ERROR (4) is returned
    511 # if the program failed to run, -PS_EXIT_PROG_ERROR (-4) is returned
    512 sub parse_error_message {
    513     my $success = shift;
    514     my $error_msg = shift;
    515     my $command = shift;
    516 
    517     if ($success) { return 0; }
    518 
    519     print "raw error_msg: $error_msg\n";
    520     print "full command: $command\n";
    521 
    522     if (&looks_like_number($error_msg)) { return (($error_msg >> 8) or ($PS_EXIT_PROG_ERROR)); }
    523        
    524     # which of these match?
    525     my ($error_code) = $error_msg =~ m/exited with value (\d+)/;
    526     if (defined $error_code) { return $error_code; }
    527    
    528     ($error_code) = $error_msg =~ m/died with signal (\d+)/;
    529 #   if (defined $error_code) { return (128 + $error_code); }
    530     if (defined $error_code) { return ($PS_EXIT_PROG_ERROR); }
    531    
    532     # probably failed to execute:
    533     return (-1*$PS_EXIT_PROG_ERROR);
    534 }
  • branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_get_image_job.pl

    r36048 r43052  
    1616use File::Basename;
    1717use Digest::MD5::File qw( file_md5_hex );
    18 use IPC::Cmd 0.36 qw( can_run run );
    19 
    20 
    21 use PS::IPP::Config qw( :standard );
     18use IPC::Cmd 0.36 qw( can_run );
     19
     20
     21use PS::IPP::Config qw( :standard ps_run );
    2222
    2323my $product;
     
    132132    $command .= " --verbose" if $verbose;
    133133    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    134         run(command => $command, verbose => $verbose);
     134        ps_run(command => $command, verbose => $verbose);
    135135    unless ($success) {
    136136        my_die("Unable to perform $command: $error_code", $error_code >> 8);
     
    174174        my $command = "$pstamptool -deletefile -job_id $job_id";
    175175        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    176             run(command => $command, verbose => $verbose);
     176            ps_run(command => $command, verbose => $verbose);
    177177        unless ($success) {
    178178            my_die("Unable to perform $command: $error_code", $error_code >> 8);
     
    193193    my $command = "$pstamptool -addfile -job_id $job_id -path $bundle_name";
    194194    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    195         run(command => $command, verbose => $verbose);
     195        ps_run(command => $command, verbose => $verbose);
    196196    unless ($success) {
    197197        my_die("Unable to perform $command: $error_code", $error_code >> 8);
  • branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_insert_request.pl

    r42981 r43052  
    3333    if( !defined($tmp_req_file) or !defined($workdir) or !defined ($dbname)
    3434        or !defined($dbserver));
    35 use IPC::Cmd 0.36 qw( can_run run );
     35use IPC::Cmd 0.36 qw( can_run );
    3636
    37 use PS::IPP::Config qw( :standard );
     37use PS::IPP::Config qw( :standard ps_run );
    3838
    3939use Cwd;
     
    6060    my $command = "$fhead -x 0 $tmp_req_file";
    6161    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    62         run(command => $command, verbose => $verbose);
     62        ps_run(command => $command, verbose => $verbose);
    6363    unless ($success) {
    6464        print STDERR @$stderr_buf;
     
    147147    $command .= " -label WEB.UP";
    148148    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    149         run(command => $command, verbose => $verbose);
     149        ps_run(command => $command, verbose => $verbose);
    150150    unless ($success) {
    151151        my $errbuf = join "", @$stderr_buf;
     
    172172    $command .= " -dbserver $dbserver" if $dbserver;
    173173    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    174         run(command => $command, verbose => $verbose);
     174        ps_run(command => $command, verbose => $verbose);
    175175    unless ($success) {
    176176        my $status = $error_code >> 8;
  • branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_job_run.pl

    r43048 r43052  
    1515use File::Copy;
    1616use File::Temp qw(tempfile tempdir);
    17 use Scalar::Util qw(looks_like_number);
    1817
    1918use Digest::MD5::File qw( file_md5_hex );
    2019use PS::IPP::PStamp::RequestFile qw( :standard );
    2120use PS::IPP::PStamp::Job qw( :standard );
    22 use IPC::Cmd 0.36 qw( can_run run );
     21use IPC::Cmd 0.36 qw( can_run );
    2322use POSIX;
    2423
     
    2726use PS::IPP::Metadata::List qw( parse_md_list );
    2827
    29 use PS::IPP::Config qw( :standard );
     28use PS::IPP::Config qw( :standard ps_run );
    3029
    3130my ($job_id, $redirect_output, $outputBase, $rownum, $jobType, $options);
     
    222221        my $command = "$psgetcalibinfo --cam_id $cam_id --output $calibfile --dbname $params->{imagedb}";
    223222        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    224             run(command => $command, verbose => $verbose);
     223            ps_run(command => $command, verbose => $verbose);
    225224
    226225        my $exitStatus;
     
    254253
    255254        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    256             run(command => $command, verbose => $verbose);
     255            ps_run(command => $command, verbose => $verbose);
    257256
    258257        if (WIFEXITED($error_code)) {
     
    289288
    290289            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    291                 run(command => $command, verbose => $verbose);
     290                ps_run(command => $command, verbose => $verbose);
    292291
    293292            if (WIFEXITED($error_code)) {
     
    311310                    my $command = "$fpack_gzip $tmpName > $numName";
    312311                    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    313                         run(command => $command, verbose => $verbose);
     312                        ps_run(command => $command, verbose => $verbose);
    314313
    315314                    if (WIFEXITED($error_code)) {
     
    330329                my $command = "$fpack_gzip $tmpBase.fits > $outputBase.exp.fits";
    331330                my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    332                     run(command => $command, verbose => $verbose);
     331                    ps_run(command => $command, verbose => $verbose);
    333332
    334333                if (WIFEXITED($error_code)) {
     
    412411    $command .= " --verbose" if $verbose;
    413412    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    414         run(command => $command, verbose => $verbose);
     413        ps_run(command => $command, verbose => $verbose);
    415414
    416415    if ($success) {
     
    437436    $command .= " --save-temps" if $save_temps;
    438437    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    439         run(command => $command, verbose => $verbose);
     438        ps_run(command => $command, verbose => $verbose);
    440439
    441440    # Although dqueryparse can potentially force more updates (and more jobs), it should still return success.
     
    461460    if (!$no_update) {
    462461        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    463             run(command => $command, verbose => $verbose);
     462            ps_run(command => $command, verbose => $verbose);
    464463        unless ($success) {
    465464            die("Unable to perform $command: $error_code");
     
    652651
    653652    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    654         run(command => $command, verbose => $verbose);
     653        ps_run(command => $command, verbose => $verbose);
    655654    unless ($success) {
    656655        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     
    826825            my $command = "$stack_bkg_mk_mdc --stack_id $stack_id --camera $camera --dbname $imagedb > $mdcfile";
    827826            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    828                 run(command => $command, verbose => $verbose);
     827                ps_run(command => $command, verbose => $verbose);
    829828            unless ($success) {
    830829                $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     
    842841            $command .= " -mask $input_mask" if $input_mask;
    843842            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    844                 run(command => $command, verbose => $very_verbose);
     843                ps_run(command => $command, verbose => $very_verbose);
    845844            unless ($success) {
    846845                # we turned off verbosity because ppBackgroundStack emits too much output
     
    867866
    868867            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    869                 run(command => $command, verbose => $verbose);
     868                ps_run(command => $command, verbose => $verbose);
    870869            unless ($success) {
    871870                print STDERR join "", @$stderr_buf;
     
    947946    exit $exit_code;
    948947}
    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_listjobs.pl

    r42981 r43052  
    3636}
    3737
    38 use IPC::Cmd 0.36 qw( can_run run );
     38use IPC::Cmd 0.36 qw( can_run );
    3939
    4040use PS::IPP::Metadata::Config;
     
    5252                       metadataLookupBool
    5353                       caturi
     54                       ps_run
    5455                       );
    5556
     
    7273    $command .= " -dbserver $dbserver" if $dbserver;
    7374    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    74         run(command => $command, verbose => $verbose);
     75        ps_run(command => $command, verbose => $verbose);
    7576    unless ($success) {
    7677        die("Unable to perform pstamptool -pendingreq: $error_code");
  • branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_parser_run.pl

    r43048 r43052  
    1313use Getopt::Long qw( GetOptions );
    1414use File::Basename qw( basename dirname);
    15 use Scalar::Util qw(looks_like_number);
    1615use File::Copy;
    1716use POSIX qw( strftime );
    1817use Carp;
    19 use IPC::Cmd 0.36 qw( can_run run );
     18use IPC::Cmd 0.36 qw( can_run );
    2019
    2120use PS::IPP::Metadata::Config;
     
    2322use PS::IPP::Metadata::List qw( parse_md_list );
    2423
    25 use PS::IPP::Config qw( :standard );
     24use PS::IPP::Config qw( :standard ps_run );
    2625use PS::IPP::PStamp::RequestFile qw( :standard );
    2726
     
    129128    # if the uri is an http uri download the file
    130129    my $command = "$dsget --uri $uri --filename $new_uri --timeout 120";
    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);
     130    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     131        ps_run(command => $command, verbose => $verbose);
    134132    unless ($success) {
    135         my_die("Unable to perform $command error code: $error_code", $req_id, $error_code);
     133        my_die("Unable to perform $command error code: $error_code", $req_id, $error_code >> 8);
    136134    }
    137135} elsif ($uri ne $new_uri) {
     
    206204    $command   .= " -dbname $dbname" if $dbname;
    207205    $command   .= " -dbserver $dbserver" if $dbserver;
    208     my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) =
     206    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    209207        run(command => $command, verbose => $verbose);
    210     my $error_code = &parse_error_message ($success, $error_msg, $command);
    211208    unless ($success) {
    212209        die("Unable to perform $command error code: $error_code");
     
    230227
    231228    my $command = "$parse_cmd";
    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);
     229    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     230        ps_run(command => $command, verbose => $verbose);
    235231
    236232    # save the contents of stderr (if any) to a file. This is relevant if
     
    258254        }
    259255    } else {
    260         $fault = $error_code;
     256        $fault = $error_code >> 8;
    261257    }
    262258}
     
    275271    $command   .= " -dbserver $dbserver" if $dbserver;
    276272    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    277         run(command => $command, verbose => $verbose);
     273        ps_run(command => $command, verbose => $verbose);
    278274    unless ($success) {
    279275        die("Unable to perform $command error code: $error_code");
     
    324320    $command   .= " -dbserver $dbserver" if $dbserver;
    325321    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    326         run(command => $command, verbose => $verbose);
     322        ps_run(command => $command, verbose => $verbose);
    327323    unless ($success) {
    328324        die("Unable to perform $command error code: $error_code");
     
    330326    exit $fault;
    331327}
    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

    r43048 r43052  
    66use warnings;
    77
    8 use PS::IPP::Config 1.01 qw( :standard );
    9 use IPC::Cmd 0.36 qw( can_run run );
     8use PS::IPP::Config 1.01 qw( :standard ps_run );
     9use IPC::Cmd 0.36 qw( can_run );
    1010use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
    1111use Pod::Usage qw( pod2usage );
    12 use Scalar::Util qw(looks_like_number);
    1312
    1413my $verbose;
     
    7069
    7170my $command = "$pstamptool -updatereq -set_state goto_cleaned -state stop -timestamp_end $timestamp_end";
    72 my  ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) =
    73     run(command => $command, verbose => $verbose);
    74 my $error_code = &parse_error_message ($success, $error_msg, $command);
     71my  ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     72    ps_run(command => $command, verbose => $verbose);
    7573unless ($success) {
    76     $error_code = ($error_code or 1);
     74    $error_code = (($error_code >> 8) or 1);
    7775    warn("$command failed. exit status: $error_code");
    7876    exit $error_code;
     
    8280exit 0;
    8381
    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

    r43048 r43052  
    1111
    1212use Getopt::Long qw( GetOptions );
    13 use Scalar::Util qw(looks_like_number);
    1413
    1514use Sys::Hostname;
     
    3534}
    3635
    37 use IPC::Cmd 0.36 qw( can_run run );
     36use IPC::Cmd 0.36 qw( can_run );
    3837
    3938use PS::IPP::Metadata::Config;
     
    5150                       metadataLookupBool
    5251                       caturi
     52                       ps_run
    5353                       );
    5454
     
    7878    $command .= " -dbserver $dbserver" if $dbserver;
    7979
    80     my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) =
    81         run(command => $command, verbose => $verbose);
    82     my $error_code = &parse_error_message ($success, $error_msg, $command);
     80    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     81        ps_run(command => $command, verbose => $verbose);
    8382    unless ($success) {
    84         my $rc = $error_code;
     83        my $rc = ($error_code >> 8);
    8584        die("Unable to perform pstamptool -datastore: $rc");
    8685    }
     
    123122        $command .= " --timeout $timeout";
    124123
    125         my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) =
    126             run(command => $command, verbose => $verbose);
    127         my $error_code = &parse_error_message ($success, $error_msg, $command);
     124        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     125            ps_run(command => $command, verbose => $verbose);
    128126        unless ($success) {
    129127            # dsproductls exit status is the http error code - 300
    130             my $exit_status = $error_code;
     128            my $exit_status = ($error_code >> 8);
    131129
    132130            # don't die on "common faults"
     
    170168        {
    171169            my $command = "$dsfilesetls --uri $uri";
    172             my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) =
    173                     run(command => $command, verbose => $verbose);
    174             my $error_code = &parse_error_message ($success, $error_msg, $command);
     170            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     171                    ps_run(command => $command, verbose => $verbose);
    175172            unless ($success) {
    176173                # we don't want to die here. We need to set lastFileset
     
    201198                $command .= " -dbserver $dbserver" if $dbserver;
    202199
    203                 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) =
    204                         run(command => $command, verbose => $verbose);
    205                 my $error_code = &parse_error_message ($success, $error_msg, $command);
     200                my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     201                        ps_run(command => $command, verbose => $verbose);
    206202
    207203                unless ($success) {
     
    217213            $command .= " -dbname $dbname" if $dbname;
    218214            $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);
     215            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     216                ps_run(command => $command, verbose => $verbose);
    222217            unless ($success) {
    223218                die("Unable to perform pstamptool -moddatastore: $error_code");
     
    238233                $command .= " -dbname $dbname" if $dbname;
    239234                $command .= " -dbserver $dbserver" if $dbserver;
    240     my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) =
     235    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    241236        run(command => $command, verbose => $verbose);
    242     my $error_code = &parse_error_message ($success, $error_msg, $command);
    243237    unless ($success) {
    244238        die("Unable to perform pstamptool -moddatastore: $error_code");
    245239    }
    246240}
    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

    r43048 r43052  
    66use warnings;
    77
    8 use PS::IPP::Config 1.01 qw( :standard );
    9 use IPC::Cmd 0.36 qw( can_run run );
     8use PS::IPP::Config 1.01 qw( :standard ps_run );
     9use IPC::Cmd 0.36 qw( can_run );
    1010use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
    1111use Pod::Usage qw( pod2usage );
    12 use Scalar::Util qw(looks_like_number);
    1312
    1413my $verbose;
     
    6766
    6867my $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);
     68my  ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     69    ps_run(command => $command, verbose => $very_verbose);
    7270unless ($success) {
    73     $error_code = ($error_code or 1);
     71    $error_code = (($error_code >> 8) or 1);
    7472    warn("$command failed. exit status: $error_code");
    7573    exit $error_code;
     
    8886        $command .= " -dbname $imagedb";
    8987
    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);
    9390        unless ($success) {
    94             $error_code = ($error_code or 1);
     91            $error_code = (($error_code >> 8) or 1);
    9592            warn("$command failed. exit status: $error_code");
    9693            exit $error_code;
     
    10198exit 0;
    10299
    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_revert_request.pl

    r42981 r43052  
    1010
    1111use Sys::Hostname;
    12 use IPC::Cmd 0.36 qw( can_run run );
     12use IPC::Cmd 0.36 qw( can_run );
    1313use File::Temp qw( tempfile );
    1414use File::Copy;
     
    2828                       metadataLookupBool
    2929                       caturi
     30                       ps_run
    3031                       );
    3132
     
    6869    $command   .= " -dbserver $dbserver" if $dbserver;
    6970    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    70         run(command => $command, verbose => $verbose);
     71        ps_run(command => $command, verbose => $verbose);
    7172    unless ($success) {
    7273        die("Unable to perform $command error code: $error_code");
     
    102103#    $command .= " --dbname $dbname" if $dbname;
    103104    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    104         run(command => $command, verbose => $verbose);
     105        ps_run(command => $command, verbose => $verbose);
    105106    unless ($success) {
    106107        die "Unable to perform $command error code: $error_code";
     
    114115    $command   .= " -dbserver $dbserver" if $dbserver;
    115116    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    116         run(command => $command, verbose => $verbose);
     117        ps_run(command => $command, verbose => $verbose);
    117118    unless ($success) {
    118119        die("Unable to perform $command error code: $error_code");
  • branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_save_server_status.pl

    r43048 r43052  
    77use warnings;
    88
    9 use PS::IPP::Config 1.01 qw( :standard );
    10 use IPC::Cmd 0.36 qw( can_run run );
     9use PS::IPP::Config 1.01 qw( :standard ps_run );
     10use IPC::Cmd 0.36 qw( can_run );
    1111use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
    1212use Pod::Usage qw( pod2usage );
    13 use Scalar::Util qw(looks_like_number);
    1413
    1514my $updatelink;
     
    6463my $command = "pstamp_server_status --workdir $pstamp_workdir > $file";
    6564#my $command = "pstamp_server_status > $file";
    66 my  ( $success, $error_msgo, $full_buf, $stdout_buf, $stderr_buf ) =
    67     run(command => $command, verbose => $verbose);
    68 my $error_code = &parse_error_message ($success, $error_msg, $command);
     65my  ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     66    ps_run(command => $command, verbose => $verbose);
    6967unless ($success) {
    70     $error_code = ($error_code or 1);
     68    $error_code = (($error_code >> 8) or 1);
    7169    warn("$command failed. exit status: $error_code");
    7270    exit $error_code;
     
    8280
    8381exit 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

    r43048 r43052  
    77
    88#use DBI;
    9 use IPC::Cmd 0.36 qw( can_run run );
     9use IPC::Cmd 0.36 qw( can_run );
    1010#use PS::IPP::Metadata::Config;
    11 use PS::IPP::Config 1.01 qw( :standard );
     11use PS::IPP::Config 1.01 qw( :standard ps_run );
    1212
    1313use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
    1414use Pod::Usage qw( pod2usage );
    15 use Scalar::Util qw(looks_like_number);
    1615
    1716my ($rundir, $workdir, $verbose, $save_temps);
     
    7170    my $serverRunning = 0;
    7271    my $command = "$pantasks_client < $pantasks_script";
    73     my  ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) =
    74         run(command => $command, verbose => $verbose);
    75     my $error_code = &parse_error_message ($success, $error_msg, $command);
     72    my  ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     73        ps_run(command => $command, verbose => $verbose);
    7674    if ($success) {
    7775        $serverRunning = 1;
    7876    } else {
    79         $error_code = ($error_code or 1);
     77        $error_code = (($error_code >> 8) or 1);
    8078        if ($error_code == 12 || $error_code == 13) {
    8179            print "Postage Stamp Server is not running\n<br>";
     
    206204
    207205exit 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

    r43048 r43052  
    4646
    4747
    48 use IPC::Cmd 0.36 qw( can_run run );
     48use IPC::Cmd 0.36 qw( can_run );
    4949
    5050use PS::IPP::Config qw($PS_EXIT_SUCCESS
     
    5858                       metadataLookupBool
    5959                       caturi
     60                       ps_run
    6061                       );
    6162
     
    102103
    103104    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    104         run(command => $command, verbose => $verbose);
     105        ps_run(command => $command, verbose => $verbose);
    105106    unless ($success) {
    106107        print STDERR @$stderr_buf;
     
    120121    $command .= " -dbserver $dbserver" if $dbserver;
    121122    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    122         run(command => $command, verbose => $verbose);
     123        ps_run(command => $command, verbose => $verbose);
    123124    unless ($success) {
    124125        print STDERR @$stderr_buf;
     
    140141    $command .= " -dbserver $dbserver" if $dbserver;
    141142    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    142         run(command => $command, verbose => $verbose);
     143        ps_run(command => $command, verbose => $verbose);
    143144    unless ($success) {
    144145        print STDERR @$stderr_buf;
  • branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstampparse.pl

    r43048 r43052  
    1515use File::Temp qw(tempfile);
    1616use File::Basename qw(basename);
    17 use Scalar::Util qw(looks_like_number);
    1817use Carp;
    1918use POSIX;
     
    6766}
    6867
    69 use IPC::Cmd 0.36 qw( can_run run );
     68use IPC::Cmd 0.36 qw( can_run );
    7069
    7170use PS::IPP::Metadata::Config;
     
    7372use PS::IPP::Metadata::List qw( parse_md_list );
    7473
    75 use PS::IPP::Config qw( :standard );
     74use PS::IPP::Config qw( :standard ps_run );
    7675my $ipprc = PS::IPP::Config->new(); # IPP Configuration
    7776
     
    127126{
    128127    my $command = "echo $request_file_name | $fields -x 0 EXTNAME EXTVER REQ_NAME ACTION EMAIL";
    129     my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) =
    130         run(command => $command, verbose => $verbose);
    131     my $error_code = &parse_error_message ($success, $error_msg, $command);
     128    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     129        ps_run(command => $command, verbose => $verbose);
    132130
    133131    # note fields doesn't return zero when it succeeds.
     132    # XXX EAM 2026.06.10 : the above note has not been true since 2007!
    134133    $fields_output = join "", @$stdout_buf;
    135134}
     
    186185    my $command = "$pstamptool -listreq  -name $req_name -not_req_id $req_id";
    187186    # no verbose so that error message about request not found doesn't appear in parse_error.txt
    188     my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) =
    189         run(command => $command, verbose => 0);
    190     my $error_code = &parse_error_message ($success, $error_msg, $command);
    191     my $exitStatus = $error_code;
     187    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     188        ps_run(command => $command, verbose => 0);
     189    my $exitStatus = $error_code >> 8;
    192190    if ($success) {
    193191        # -listreq succeeded there is already a request in the database with this name
     
    285283    unless ($no_update) {
    286284        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    287             run(command => $command, verbose => $verbose);
     285            ps_run(command => $command, verbose => $verbose);
    288286        unless ($success) {
    289287            my_die("$command failed", $PS_EXIT_UNKNOWN_ERROR);
     
    313311    my $command = "$pstampdump $request_file_name";
    314312    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    315         run(command => $command, verbose => $verbose);
     313        ps_run(command => $command, verbose => $verbose);
    316314    unless ($success) {
    317315        print STDERR @$stderr_buf;
     
    394392    my $command = "$pstamptool -updatereq -req_id $req_id  -set_label $label";
    395393    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    396         run(command => $command, verbose => $verbose);
     394        ps_run(command => $command, verbose => $verbose);
    397395    unless ($success) {
    398396        my_die("$command failed", $PS_EXIT_UNKNOWN_ERROR);
     
    822820        my $start_addjob = gettimeofday();
    823821        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    824             run(command => $command, verbose => $verbose);
     822            ps_run(command => $command, verbose => $verbose);
    825823        unless ($success) {
    826824            print STDERR @$stderr_buf;
     
    977975            # mode eq "queue_job"
    978976            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    979                 run(command => $command, verbose => $verbose);
     977                ps_run(command => $command, verbose => $verbose);
    980978            unless ($success) {
    981979                print STDERR @$stderr_buf;
     
    10301028        # mode eq "queue_job"
    10311029        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    1032             run(command => $command, verbose => $verbose);
     1030            ps_run(command => $command, verbose => $verbose);
    10331031        unless ($success) {
    10341032            print STDERR @$stderr_buf;
     
    11391137
    11401138    if (!$no_update) {
    1141         my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) =
    1142             run(command => $command, verbose => $verbose);
    1143         my $error_code = &parse_error_message ($success, $error_msg, $command);
     1139        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     1140            ps_run(command => $command, verbose => $verbose);
    11441141        unless ($success) {
    1145             my $fault = $error_code;
     1142            my $fault = $error_code >> 8;
    11461143            print STDERR "$command failed with fault $fault\n";
    11471144            if ($fault < $PSTAMP_FIRST_ERROR_CODE) {
     
    14251422    exit $fault;
    14261423}
    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 
  • branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/request_finish.pl

    r42981 r43052  
    1010
    1111use Sys::Hostname;
    12 use IPC::Cmd 0.36 qw( can_run run );
     12use IPC::Cmd 0.36 qw( can_run );
    1313use File::Temp qw( tempfile );
    1414use File::Copy;
     
    1919use PS::IPP::Metadata::List qw( parse_md_list );
    2020
    21 use PS::IPP::Config qw( :standard );
     21use PS::IPP::Config qw( :standard ps_run );
    2222use PS::IPP::PStamp::RequestFile qw( :standard );
    2323
     
    9191    $command   .= " --save-temps" if $save_temps;
    9292    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    93         run(command => $command, verbose => $verbose);
     93        ps_run(command => $command, verbose => $verbose);
    9494    unless ($success) {
    9595        die("Unable to perform $command error code: $error_code");
     
    103103    $command   .= " -dbserver $dbserver" if $dbserver;
    104104    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    105         run(command => $command, verbose => $verbose);
     105        ps_run(command => $command, verbose => $verbose);
    106106    unless ($success) {
    107107        die("Unable to perform $command error code: $error_code");
Note: See TracChangeset for help on using the changeset viewer.