From ba104d67600cd96beb14097551d3bc2fe50da580 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Wed, 19 Aug 2020 08:54:08 +0200 Subject: [PATCH] run command: fix matching \r\n and use non-capturing group for it Signed-off-by: Thomas Lamprecht --- src/PVE/Tools.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PVE/Tools.pm b/src/PVE/Tools.pm index d9c69e3..f9270d9 100644 --- a/src/PVE/Tools.pm +++ b/src/PVE/Tools.pm @@ -497,7 +497,7 @@ sub run_command { if ($h eq $reader) { if ($outfunc || $logfunc) { eval { - while ($buf =~ s/^([^\010\r\n]*)(\r|\n|(\010)+|\r\n)//) { + while ($buf =~ s/^([^\010\r\n]*)(?:\n|(?:\010)+|\r\n?)//) { my $line = $outlog . $1; $outlog = ''; &$outfunc($line) if $outfunc; @@ -518,7 +518,7 @@ sub run_command { } elsif ($h eq $error) { if ($errfunc || $logfunc) { eval { - while ($buf =~ s/^([^\010\r\n]*)(\r|\n|(\010)+|\r\n)//s) { + while ($buf =~ s/^([^\010\r\n]*)(?:\n|(?:\010)+|\r\n?)//) { my $line = $errlog . $1; $errlog = ''; &$errfunc($line) if $errfunc; -- 2.39.2