projects
/
pve-cluster.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
dd92cac
)
refactor run_silent_cmd
author
Thomas Lamprecht
<t.lamprecht@proxmox.com>
Fri, 14 Dec 2018 10:07:42 +0000
(11:07 +0100)
committer
Thomas Lamprecht
<t.lamprecht@proxmox.com>
Fri, 14 Dec 2018 10:07:42 +0000
(11:07 +0100)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
data/PVE/Cluster.pm
patch
|
blob
|
blame
|
history
diff --git
a/data/PVE/Cluster.pm
b/data/PVE/Cluster.pm
index 93c3f01eff2e6529017d7b36ba3bf565bbd40c74..f4dd1a3a1877254d015f9513cf4c1c3d372d5977 100644
(file)
--- a/
data/PVE/Cluster.pm
+++ b/
data/PVE/Cluster.pm
@@
-93,20
+93,11
@@
sub run_silent_cmd {
my ($cmd) = @_;
my $outbuf = '';
+ my $record = sub { $outbuf .= shift . "\n"; };
- my $record_output = sub {
- $outbuf .= shift;
- $outbuf .= "\n";
- };
-
- eval {
- PVE::Tools::run_command($cmd, outfunc => $record_output,
- errfunc => $record_output);
- };
+ eval { run_command($cmd, outfunc => $record, errfunc => $record) };
- my $err = $@;
-
- if ($err) {
+ if (my $err = $@) {
print STDERR $outbuf;
die $err;
}