IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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 
Note: See TracChangeset for help on using the changeset viewer.