[pve-devel] [v2 qemu-server 05/10] qm mtunnel: add write helper
Fabian Grünbichler
f.gruenbichler at proxmox.com
Fri Aug 4 14:54:02 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 07e3b2e..7b161e3 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\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");
while (my $line = <>) {
chomp $line;
--
2.11.0
More information about the pve-devel
mailing list