|
Lines 53-66
push @su_args,
Link Here
|
| 53 |
. ( $opts{command} ? " -c '$opts{command}'" : '' ); |
53 |
. ( $opts{command} ? " -c '$opts{command}'" : '' ); |
| 54 |
|
54 |
|
| 55 |
print "Command: '".join("' '",@su_args)."'\n" if $opts{verbose}; |
55 |
print "Command: '".join("' '",@su_args)."'\n" if $opts{verbose}; |
| 56 |
system("@su_args"); |
56 |
my $r = system("@su_args"); |
| 57 |
if ( $? == -1 ) { |
57 |
if ( $r == -1 ) { |
| 58 |
print STDERR "failed to execute: $!\n"; |
58 |
die "failed to execute: $!\n"; |
| 59 |
} |
59 |
} |
| 60 |
elsif ( $? & 127 ) { |
60 |
elsif ( $r & 127 ) { |
| 61 |
printf STDERR "child died with signal %d, %s coredump\n", |
61 |
die "child died with signal %d, %s coredump\n", |
| 62 |
( $? & 127 ), ( $? & 128 ) ? 'with' : 'without'; |
62 |
( $r & 127 ), ( $r & 128 ) ? 'with' : 'without'; |
| 63 |
} |
63 |
} |
|
|
64 |
exit(0) if $r == 0; |
| 65 |
exit(1); |
| 64 |
|
66 |
|
| 65 |
sub show_help { |
67 |
sub show_help { |
| 66 |
my ( $err, $msg ) = @_; |
68 |
my ( $err, $msg ) = @_; |
| 67 |
- |
|
|