mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
Adds a --silent option to the CLI (#2803)
* Adds a --silent option to the CLI * Fixes silent opt not to silence stderr * Removes un-used arg variable from CLI opt block handler
This commit is contained in:
parent
03be0aaf01
commit
3f3c2f6eb0
2 changed files with 15 additions and 0 deletions
|
@ -185,6 +185,10 @@ module Puma
|
|||
user_config.restart_command cmd
|
||||
end
|
||||
|
||||
o.on "-s", "--silent", "Do not log prompt messages other than errors" do
|
||||
@events = Events.new NullIO.new, $stderr
|
||||
end
|
||||
|
||||
o.on "-S", "--state PATH", "Where to store the state details" do |arg|
|
||||
user_config.state_path arg
|
||||
end
|
||||
|
|
|
@ -475,4 +475,15 @@ class TestCLI < Minitest::Test
|
|||
ensure
|
||||
ENV.delete 'RAILS_ENV'
|
||||
end
|
||||
|
||||
def test_silent
|
||||
cli = Puma::CLI.new ['--silent']
|
||||
cli.send(:setup_options)
|
||||
|
||||
events = cli.instance_variable_get(:@events)
|
||||
|
||||
assert_equal events.class, Puma::Events.null.class
|
||||
assert_equal events.stdout.class, Puma::NullIO
|
||||
assert_equal events.stderr, $stderr
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue