utils: Homebrew.system respect stderr
This caused some JSON output to break recently which is not ideal. The change here is to check if the output should be diverted to stderr based on the options passed to system. If `:out => :err` is passed, then we should send any verbose output to stderr as well. ```console $ brew ruby -e 'Homebrew.system("ls", :out => :err)' 2>| wc -c 105 $ brew ruby -e 'Homebrew.system("ls")' | wc -c 105 ```
This commit is contained in:
parent
97eda64790
commit
1118a49d42
@ -43,8 +43,9 @@ module Homebrew
|
||||
|
||||
def self.system(cmd, *args, **options)
|
||||
if verbose?
|
||||
puts "#{cmd} #{args * " "}".gsub(RUBY_PATH, "ruby")
|
||||
.gsub($LOAD_PATH.join(File::PATH_SEPARATOR).to_s, "$LOAD_PATH")
|
||||
out = (options[:out] == :err) ? $stderr : $stdout
|
||||
out.puts "#{cmd} #{args * " "}".gsub(RUBY_PATH, "ruby")
|
||||
.gsub($LOAD_PATH.join(File::PATH_SEPARATOR).to_s, "$LOAD_PATH")
|
||||
end
|
||||
_system(cmd, *args, **options)
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user