X-Git-Url: https://git.proxmox.com/?p=pve-common.git;a=blobdiff_plain;f=src%2FPVE%2FINotify.pm;h=8b5544e5477096ce9b7c1650a3af9ede7ed1da30;hp=dee9a3e9b2b6a48b0780b5a76feda425b269e5c1;hb=69758574a14c9614708409da38af8cc865cd614e;hpb=1b505ae2390fe355600a9405c4f29879e62769b9;ds=sidebyside diff --git a/src/PVE/INotify.pm b/src/PVE/INotify.pm index dee9a3e..8b5544e 100644 --- a/src/PVE/INotify.pm +++ b/src/PVE/INotify.pm @@ -19,7 +19,8 @@ use PVE::ProcFSTools; use Clone qw(clone); use Linux::Inotify2; use base 'Exporter'; -use JSON; +use JSON; +use Encode qw(encode decode); our @EXPORT_OK = qw(read_file write_file register_file); @@ -56,13 +57,11 @@ sub ccache_compute_diff { my $diff = ''; - open (TMP, "diff -b -N -u '$filename' '$shadow'|"); - - while (my $line = ) { - $diff .= $line; - } - - close (TMP); + my $cmd = ['/usr/bin/diff', '-b', '-N', '-u', $filename, $shadow]; + PVE::Tools::run_command($cmd, noerr => 1, outfunc => sub { + my ($line) = @_; + $diff .= decode('UTF-8', $line) . "\n"; + }); $diff = undef if !$diff;