because we want commands to return meaningful errors, and
print them on the client/source side.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
while (my $line = <>) {
chomp $line;
- last if $line =~ m/^quit$/;
+ if ($line =~ /^quit$/) {
+ $tunnel_write->("OK");
+ last;
+ }
}
return undef;
});
};
die "writing to tunnel failed: $@\n" if $@;
+
+ if ($tunnel->{version} && $tunnel->{version} >= 1) {
+ my $res = eval { $self->read_tunnel($tunnel, 10); };
+ die "no reply to command '$command': $@\n" if $@;
+
+ if ($res eq 'OK') {
+ return;
+ } else {
+ die "tunnel replied '$res' to command '$command'\n";
+ }
+ }
}
sub fork_tunnel {