Skip to content
Snippets Groups Projects
Commit fd7f3b94 authored by Xu Cheng's avatar Xu Cheng
Browse files

Pathname#abv: handle the case `du` returns empty string


This can happen when read permission is denied.

Fixes Homebrew/homebrew#41925.

Closes Homebrew/homebrew#42011.

Signed-off-by: default avatarXu Cheng <xucheng@me.com>
parent ebd0f345
No related branches found
No related tags found
No related merge requests found
......@@ -393,7 +393,9 @@ class Pathname
out = ""
n = Utils.popen_read("find", expand_path.to_s, "-type", "f", "!", "-name", ".DS_Store").split("\n").size
out << "#{n} files, " if n > 1
out << Utils.popen_read("/usr/bin/du", "-hs", expand_path.to_s).split("\t")[0].strip
size = Utils.popen_read("/usr/bin/du", "-hs", expand_path.to_s).split("\t")[0]
size ||= "0B"
out << size.strip
out
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment