1
0
Fork 0
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:
Pierre-Louis Gottfrois 2022-01-19 17:31:46 +01:00 committed by GitHub
parent 03be0aaf01
commit 3f3c2f6eb0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

View file

@ -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

View file

@ -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