Skip to content

Commit

Permalink
Skip fetching file sizes if no files found
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
salimepoint committed Mar 22, 2022
1 parent d551cad commit 147c58b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down

0 comments on commit 147c58b

Please sign in to comment.