[pve-devel] [PATCH qemu-server 05/10] qm mtunnel: add write helper
Fabian Grünbichler
f.gruenbichler at proxmox.com
Fri Aug 4 10:55:04 CEST 2017
reduce code duplication.
Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
PVE/CLI/qm.pm | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/PVE/CLI/qm.pm b/PVE/CLI/qm.pm
index 77fd983..bc4fe33 100755
--- a/PVE/CLI/qm.pm
+++ b/PVE/CLI/qm.pm
@@ -265,11 +265,15 @@ __PACKAGE__->register_method ({
return undef;
}
- print "tunnel online\n";
- *STDOUT->flush();
-
- print "ver 1.0\n";
- *STDOUT->flush();
+ my $tunnel_write = sub {
+ my $text = shift;
+ chomp $text;
+ print "$text\n";
+ *STDOUT->flush();
+ };
+
+ $tunnel_write->("tunnel online");
+ $tunnel_write->("ver 1.0");
while (my $line = <>) {
chomp $line;
--
2.11.0
More information about the pve-devel
mailing list