mirror of
https://github.com/capistrano/capistrano
synced 2023-03-27 23:21:18 -04:00
Update capture() to warn about stderr instead of raising CaptureError.
This commit is contained in:
parent
074d75a006
commit
a6223b3939
3 changed files with 13 additions and 5 deletions
|
@ -1,3 +1,8 @@
|
|||
*unreleased*
|
||||
|
||||
* Changed capture() helper to not raise an exception on error, but to warn instead [Jeff Forcier]
|
||||
|
||||
|
||||
*2.4.0* June 13, 2008
|
||||
|
||||
* Added :normalize_asset_timestamps option to deployment, defaulting to true, which allows asset timestamping to be disabled [John Trupiano]
|
||||
|
|
|
@ -34,7 +34,7 @@ module Capistrano
|
|||
invoke_command(command, options.merge(:once => true)) do |ch, stream, data|
|
||||
case stream
|
||||
when :out then output << data
|
||||
when :err then raise CaptureError, "error processing #{command.inspect}: #{data.inspect}"
|
||||
when :err then warn "[err :: #{ch[:server]}] #{data}"
|
||||
end
|
||||
end
|
||||
output
|
||||
|
|
|
@ -37,9 +37,12 @@ class ConfigurationActionsInspectTest < Test::Unit::TestCase
|
|||
@config.capture("hostname", :foo => "bar")
|
||||
end
|
||||
|
||||
def test_capture_with_stderr_result_should_raise_capture_error
|
||||
@config.expects(:invoke_command).yields(mock("channel"), :err, "boom")
|
||||
assert_raises(Capistrano::CaptureError) { @config.capture("hostname") }
|
||||
def test_capture_with_stderr_should_emit_stderr_via_warn
|
||||
ch = mock("channel")
|
||||
ch.expects(:[]).with(:server).returns(server("capistrano"))
|
||||
@config.expects(:invoke_command).yields(ch, :err, "boom")
|
||||
@config.expects(:warn).with("[err :: capistrano] boom")
|
||||
@config.capture("hostname")
|
||||
end
|
||||
|
||||
def test_capture_with_stdout_should_aggregate_and_return_stdout
|
||||
|
|
Loading…
Reference in a new issue