mirror of https://github.com/digint/btrbk
btrbk: catch ssh errors
parent
df471c3692
commit
a80e05984a
9
btrbk
9
btrbk
|
@ -696,6 +696,7 @@ sub run_cmd(@)
|
||||||
my @unsafe_cmd;
|
my @unsafe_cmd;
|
||||||
my $compressed = undef;
|
my $compressed = undef;
|
||||||
my $stream_options = $cmd_pipe_in[0]->{stream_options} // {};
|
my $stream_options = $cmd_pipe_in[0]->{stream_options} // {};
|
||||||
|
my $has_rsh;
|
||||||
|
|
||||||
$cmd_pipe_in[0]->{stream_source} = 1;
|
$cmd_pipe_in[0]->{stream_source} = 1;
|
||||||
$cmd_pipe_in[-1]->{stream_sink} = 1;
|
$cmd_pipe_in[-1]->{stream_sink} = 1;
|
||||||
|
@ -708,6 +709,7 @@ sub run_cmd(@)
|
||||||
$filter_stderr = $href->{filter_stderr} if($href->{filter_stderr}); # NOTE: last filter wins!
|
$filter_stderr = $href->{filter_stderr} if($href->{filter_stderr}); # NOTE: last filter wins!
|
||||||
$destructive = 1 unless($href->{non_destructive});
|
$destructive = 1 unless($href->{non_destructive});
|
||||||
$exitcode_loglevel = $href->{exitcode_loglevel} if($href->{exitcode_loglevel});
|
$exitcode_loglevel = $href->{exitcode_loglevel} if($href->{exitcode_loglevel});
|
||||||
|
$has_rsh = 1 if($href->{rsh});
|
||||||
|
|
||||||
if($href->{check_unsafe}) {
|
if($href->{check_unsafe}) {
|
||||||
_safe_cmd($href->{check_unsafe}, \@unsafe_cmd);
|
_safe_cmd($href->{check_unsafe}, \@unsafe_cmd);
|
||||||
|
@ -853,6 +855,13 @@ sub run_cmd(@)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($has_rsh && ($exitcode == 255)) {
|
||||||
|
# SSH returns exit status 255 if an error occurred.
|
||||||
|
$cmd_print =~ s/ssh -q/ssh/g;
|
||||||
|
ERROR "SSH command failed: `$cmd_print`";
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
|
||||||
if($exitcode || $stderr_fatal) {
|
if($exitcode || $stderr_fatal) {
|
||||||
my $log_text = "Command execution failed (exitcode=$exitcode): `$cmd_print`";
|
my $log_text = "Command execution failed (exitcode=$exitcode): `$cmd_print`";
|
||||||
if($exitcode_loglevel eq "error") { ERROR $log_text; }
|
if($exitcode_loglevel eq "error") { ERROR $log_text; }
|
||||||
|
|
Loading…
Reference in New Issue