Changeset 43048 for branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_save_server_status.pl
- Timestamp:
- Jun 1, 2026, 4:53:16 PM (7 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-pstamp-20260421/pstamp/scripts/pstamp_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 }
Note:
See TracChangeset
for help on using the changeset viewer.
