Move a number of tests to xt, restructure extra lists
[dbsrgits/DBIx-Class-Historic.git] / maint / getstatus
CommitLineData
83da25f0 1#!/usr/bin/perl
2
3use warnings;
4use strict;
5
6use Config;
7use Term::ANSIColor ':constants';
8my $CRST = RESET;
9my $CCODE = BOLD;
10my $CSTAT = BOLD . GREEN;
11my $CCORE = BOLD . CYAN;
12my $CSIG = CYAN;
13
14if (@ARGV) {
15 my $code = system (@ARGV);
16
17 if ($code < 0) {
18 exit 127;
19 }
20 elsif ($code > 0) {
21
22 my $status = $code >> 8;
23 my $signum = $code & 127;
24 my $core = $code & 128;
25
26 my %sig_idx;
27 @sig_idx{split /\s+/, $Config{sig_num}} = split /\s/, $Config{sig_name};
28
29 printf STDERR (
30<<EOF
31
32Results of execution: `%s`
33----------------------
34System exit code:$CCODE %d $CRST$CSIG %s $CRST
35 ($CSTAT%08b$CRST$CCORE%b$CRST$CSIG%07b$CRST)
36
37Status: %3s ($CSTAT%08b$CRST)
38Signal: %3s ($CSIG%08b$CRST)
39Core: %3s
40----------------------
41EOF
42 , (join ' ', @ARGV),
43 $code, ($signum ? "(SIG-$sig_idx{$signum})" : ''),
44 $status, $core, $signum,
45 ($status) x 2,
46 ($signum) x 2,
47 ($core ? 'Yes': 'No')
48 );
49
50 exit ($status);
51 }
52}