[pve-devel] [PATCH installer 3/4] sys: command: add option to not print process output to stdout

Christoph Heiss c.heiss at proxmox.com
Fri Feb 9 11:56:00 CET 2024


Fully backwards-compatible again, only takes effect if the new argument
is actually specified.

Signed-off-by: Christoph Heiss <c.heiss at proxmox.com>
---
 Proxmox/Sys/Command.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Proxmox/Sys/Command.pm b/Proxmox/Sys/Command.pm
index bf67b27..a5129fd 100644
--- a/Proxmox/Sys/Command.pm
+++ b/Proxmox/Sys/Command.pm
@@ -40,7 +40,7 @@ sub syscmd {
 }
 
 sub run_command {
-    my ($cmd, $func, $input, $noout) = @_;
+    my ($cmd, $func, $input, $noout, $noprint) = @_;
 
     my $cmdstr;
     if (!ref($cmd)) {
@@ -127,7 +127,7 @@ sub run_command {
 	    } elsif ($h eq $error) {
 		$ostream .= $buf if !($noout || $func);
 	    }
-	    print $buf;
+	    print $buf if !$noprint;
 	    STDOUT->flush();
 	    log_info($buf);
 	}
-- 
2.43.0





More information about the pve-devel mailing list