
This collects all violations for each formula in a single place, instead of doing `brew style` outputs for all formulae first, and then the other audit checks. Closes #112. Signed-off-by: Andrew Janke <andrew@apjanke.net>
29 lines
513 B
Ruby
29 lines
513 B
Ruby
module Utils
|
|
def self.popen_read(*args, &block)
|
|
popen(args, "rb", &block)
|
|
end
|
|
|
|
def self.popen_read_text(*args, &block)
|
|
popen(args, "r", &block)
|
|
end
|
|
|
|
def self.popen_write(*args, &block)
|
|
popen(args, "wb", &block)
|
|
end
|
|
|
|
def self.popen(args, mode)
|
|
IO.popen("-", mode) do |pipe|
|
|
if pipe
|
|
if block_given?
|
|
yield pipe
|
|
else
|
|
return pipe.read
|
|
end
|
|
else
|
|
STDERR.reopen("/dev/null", "w")
|
|
exec(*args)
|
|
end
|
|
end
|
|
end
|
|
end
|