From 147c58b691f73902aca765c7e56cc2026d98fbe1 Mon Sep 17 00:00:00 2001 From: Stephen Anderson Date: Mon, 21 Mar 2022 18:54:00 +1100 Subject: [PATCH] Skip fetching file sizes if no files found If the garbage collector is called prior to there being any images in the trow registry, the stat call will cause a RuntimeError. Adding --no-run-if-empty ensures the command completes successfully. --- src/main.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rb b/src/main.rb index 658ba05..d956a40 100755 --- a/src/main.rb +++ b/src/main.rb @@ -92,7 +92,7 @@ def puts_df_data end def fetch_file_sizes - result = trow_exec("/bin/bash", "-c", "find /data/ -type f -print0 | xargs -0 -n 1 stat -c '%s %Y %n'") + result = trow_exec("/bin/bash", "-c", "find /data/ -type f -print0 | xargs --no-run-if-empty -0 -n 1 stat -c '%s %Y %n'") raise "Error: #{result.status}" unless result.status.success? result.stdout.strip.split("\n").each do |line|