From bd271c73f496250ea146fd87fda5b3f76f34e5b1 Mon Sep 17 00:00:00 2001 From: mgutt <10757176+mgutt@users.noreply.github.com> Date: Tue, 28 Oct 2025 01:53:57 +0100 Subject: [PATCH] Add -m1 to file_line grep for performance Stop after first match to avoid processing entire file --- emhttp/plugins/dynamix/nchan/file_manager | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emhttp/plugins/dynamix/nchan/file_manager b/emhttp/plugins/dynamix/nchan/file_manager index 3d488b342..66698431b 100755 --- a/emhttp/plugins/dynamix/nchan/file_manager +++ b/emhttp/plugins/dynamix/nchan/file_manager @@ -167,7 +167,7 @@ function parse_rsync_progress($status, $action_label) { // obtain filename line like: // "/mnt/disk6/images/image.jpg" // note: -v is used to obtain the opposite of the progress line regex and to filter out empty lines - $file_line = exec("tac $status | grep -v -E '(^\$|^ .*[0-9]+%.*[0-9]+:[0-9]+:[0-9]+)' | tr -s ' ' || echo ''"); + $file_line = exec("tac $status | grep -m1 -v -E '(^\$|^ .*[0-9]+%.*[0-9]+:[0-9]+:[0-9]+)' | tr -s ' ' || echo ''"); if ($file_line) { $text[0] .= htmlspecialchars(mb_strimhalf($file_line, 70, '...'), ENT_QUOTES, 'UTF-8'); }