mirror of
https://github.com/Homebrew/brew.git
synced 2026-08-12 22:29:27 +04:00
download_queue: Output API download messages to stderr when not a TTY
- With `HOMEBREW_DOWNLOAD_CONCURRENCY=1` we were seeing
`brew info hello --json=v2 | jq` fail to parse the JSON because the
start of the string was the download messages:
```
$ brew info --json hello
✔︎ JSON API formula_tap_migrations.jws.json
✔︎ JSON API cask_tap_migrations.jws.json
[
{
"name": "hello",
"full_name": "hello",
"tap": "homebrew/core",
...
$ brew info hello --json=v2 | jq
jq: parse error: Invalid numeric literal at line 1, column 7
```
This commit is contained in:
@@ -100,7 +100,7 @@ module Homebrew
|
||||
if tty
|
||||
stdout_print_and_flush "#{status} #{message}#{"\n" unless last}"
|
||||
elsif status
|
||||
puts "#{status} #{message}"
|
||||
$stderr.puts "#{status} #{message}"
|
||||
end
|
||||
|
||||
if future.rejected?
|
||||
|
||||
@@ -11,7 +11,6 @@ RSpec.describe Cask::Reinstall, :cask do
|
||||
|
||||
output = Regexp.new <<~EOS
|
||||
==> Fetching downloads for:.*caffeine
|
||||
.* Cask .*caffeine .*
|
||||
==> Uninstalling Cask local-caffeine
|
||||
==> Backing App 'Caffeine.app' up to '.*Caffeine.app'
|
||||
==> Removing App '.*Caffeine.app'
|
||||
@@ -33,7 +32,6 @@ RSpec.describe Cask::Reinstall, :cask do
|
||||
|
||||
output = Regexp.new <<~EOS
|
||||
==> Fetching downloads for:.*caffeine
|
||||
.* Cask .*caffeine .*
|
||||
==> Backing App 'Caffeine.app' up to '.*Caffeine.app'
|
||||
==> Removing App '.*Caffeine.app'
|
||||
==> Dispatching zap stanza
|
||||
|
||||
@@ -13,7 +13,7 @@ RSpec.describe Homebrew::Cmd::InstallCmd do
|
||||
|
||||
expect { brew "install", "testball1" }
|
||||
.to output(%r{#{HOMEBREW_CELLAR}/testball1/0\.1}o).to_stdout
|
||||
.and not_to_output.to_stderr
|
||||
.and output(/✔︎.*/m).to_stderr
|
||||
.and be_a_success
|
||||
expect(HOMEBREW_CELLAR/"testball1/0.1/foo/test").not_to be_a_file
|
||||
end
|
||||
@@ -23,7 +23,7 @@ RSpec.describe Homebrew::Cmd::InstallCmd do
|
||||
|
||||
expect { brew "install", "testball1", "--with-foo" }
|
||||
.to output(%r{#{HOMEBREW_CELLAR}/testball1/0\.1}o).to_stdout
|
||||
.and not_to_output.to_stderr
|
||||
.and output(/✔︎.*/m).to_stderr
|
||||
.and be_a_success
|
||||
expect(HOMEBREW_CELLAR/"testball1/0.1/foo/test").to be_a_file
|
||||
end
|
||||
@@ -37,7 +37,7 @@ RSpec.describe Homebrew::Cmd::InstallCmd do
|
||||
|
||||
expect { brew "install", "testball1" }
|
||||
.to output(%r{#{HOMEBREW_CELLAR}/testball1/1\.0}o).to_stdout
|
||||
.and not_to_output.to_stderr
|
||||
.and output(/✔︎.*/m).to_stderr
|
||||
.and be_a_success
|
||||
expect(HOMEBREW_CELLAR/"testball1/1.0/foo/test").not_to be_a_file
|
||||
end
|
||||
@@ -80,7 +80,7 @@ RSpec.describe Homebrew::Cmd::InstallCmd do
|
||||
|
||||
expect { brew "install", "testball1", "--debug-symbols", "--build-from-source" }
|
||||
.to output(%r{#{HOMEBREW_CELLAR}/testball1/0\.1}o).to_stdout
|
||||
.and not_to_output.to_stderr
|
||||
.and output(/✔︎.*/m).to_stderr
|
||||
.and be_a_success
|
||||
expect(HOMEBREW_CELLAR/"testball1/0.1/bin/test").to be_a_file
|
||||
expect(HOMEBREW_CELLAR/"testball1/0.1/bin/test.dSYM/Contents/Resources/DWARF/test").to be_a_file if OS.mac?
|
||||
@@ -90,10 +90,10 @@ RSpec.describe Homebrew::Cmd::InstallCmd do
|
||||
it "installs with asking for user prompts without installed dependent checks", :integration_test do
|
||||
setup_test_formula "testball1"
|
||||
|
||||
expect do
|
||||
brew "install", "--ask", "testball1"
|
||||
end.to output(/.*Formula\s*\(1\):\s*testball1.*/).to_stdout.and not_to_output.to_stderr
|
||||
|
||||
expect { brew "install", "--ask", "testball1" }
|
||||
.to output(/.*Formula\s*\(1\):\s*testball1.*/).to_stdout
|
||||
.and output(/✔︎.*/m).to_stderr
|
||||
.and be_a_success
|
||||
expect(HOMEBREW_CELLAR/"testball1/0.1/bin/test").to be_a_file
|
||||
end
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ RSpec.describe Homebrew::Cmd::Reinstall do
|
||||
|
||||
expect { brew "reinstall", "testball" }
|
||||
.to output(/Reinstalling testball/).to_stdout
|
||||
.and not_to_output.to_stderr
|
||||
.and output(/✔︎.*/m).to_stderr
|
||||
.and be_a_success
|
||||
|
||||
expect(foo_dir).to exist
|
||||
@@ -29,8 +29,8 @@ RSpec.describe Homebrew::Cmd::Reinstall do
|
||||
|
||||
expect { brew "reinstall", "--ask", "testball" }
|
||||
.to output(/.*Formula\s*\(1\):\s*testball.*/).to_stdout
|
||||
.and not_to_output.to_stderr
|
||||
.and be_a_success
|
||||
.and output(/✔︎.*/m).to_stderr
|
||||
.and be_a_success
|
||||
|
||||
expect(foo_dir).to exist
|
||||
end
|
||||
|
||||
@@ -35,15 +35,15 @@ RSpec.describe Homebrew::Cmd::UpgradeCmd do
|
||||
setup_test_formula "testball"
|
||||
(HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath
|
||||
|
||||
expect do
|
||||
brew "upgrade", "--ask"
|
||||
end.to output(/.*Formula\s*\(1\):\s*testball.*/).to_stdout.and not_to_output.to_stderr
|
||||
expect { brew "upgrade", "--ask" }
|
||||
.to output(/.*Formula\s*\(1\):\s*testball.*/).to_stdout
|
||||
.and output(/✔︎.*/m).to_stderr
|
||||
|
||||
expect(HOMEBREW_CELLAR/"testball/0.1").to be_a_directory
|
||||
expect(HOMEBREW_CELLAR/"testball/0.0.1").not_to exist
|
||||
end
|
||||
|
||||
it "refuses to upgrades a forbidden formula", :integration_test do
|
||||
it "refuses to upgrade a forbidden formula", :integration_test do
|
||||
setup_test_formula "testball"
|
||||
(HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath
|
||||
|
||||
|
||||
Reference in New Issue
Block a user