From 79c9e07933c0b045eef58fb680c009e7d3f9423e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Fri, 4 Aug 2017 14:54:02 +0200 Subject: [PATCH] qm mtunnel: add write helper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit reduce code duplication. Signed-off-by: Fabian Grünbichler --- PVE/CLI/qm.pm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/PVE/CLI/qm.pm b/PVE/CLI/qm.pm index 07e3b2ef..7b161e36 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(); + my $tunnel_write = sub { + my $text = shift; + chomp $text; + print "$text\n"; + *STDOUT->flush(); + }; - print "ver 1\n"; - *STDOUT->flush(); + $tunnel_write->("tunnel online"); + $tunnel_write->("ver 1"); while (my $line = <>) { chomp $line;