pathname.rb: Pass -s to du instead of -d0

The option `du -s` is equivalent to `du -d0`. The former is a POSIX standard
(IEEE Std 1003.1-2008), whereas the latter is a BSD extension.

From the BSD man page:
`-s Display an entry for each specified file. (Equivalent to -d 0)`

From SUSv4:
`-s Instead of the default output, report only the total sum for each of the specified files.`
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/du.html

Closes Homebrew/homebrew#16516.

Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
This commit is contained in:
Shaun Jackman 2012-12-11 08:29:14 -08:00 committed by Charlie Sharpsteen
parent 827e4f813f
commit 9a4567c2f9

View File

@ -164,7 +164,7 @@ class Pathname
out='' out=''
n=`find #{to_s} -type f ! -name .DS_Store | wc -l`.to_i n=`find #{to_s} -type f ! -name .DS_Store | wc -l`.to_i
out<<"#{n} files, " if n > 1 out<<"#{n} files, " if n > 1
out<<`/usr/bin/du -hd0 #{to_s} | cut -d"\t" -f1`.strip out<<`/usr/bin/du -hs #{to_s} | cut -d"\t" -f1`.strip
end end
def version def version