public
Description: Remote multi-server automation tool
Homepage: http://www.capify.org
Clone URL: git://github.com/jamis/capistrano.git
Update capture() to warn about stderr instead of raising CaptureError.
bitprophet (author)
Sat Jun 14 21:52:57 -0700 2008
jamis (committer)
Mon Jun 23 06:44:29 -0700 2008
commit  a6223b3939f0ef91c928f94502c806a68a011e74
tree    23effbf0143075d09f9874979a8e29254ff22324
parent  074d75a00621b276e2bf0a8276c77da0b3cc976f
...
 
 
 
 
 
1
2
3
...
1
2
3
4
5
6
7
8
0
@@ -1,3 +1,8 @@
0
+*unreleased*
0
+
0
+* Changed capture() helper to not raise an exception on error, but to warn instead [Jeff Forcier]
0
+
0
+
0
 *2.4.0* June 13, 2008
0
 
0
 * Added :normalize_asset_timestamps option to deployment, defaulting to true, which allows asset timestamping to be disabled [John Trupiano]
...
34
35
36
37
 
38
39
40
...
34
35
36
 
37
38
39
40
0
@@ -34,7 +34,7 @@ module Capistrano
0
           invoke_command(command, options.merge(:once => true)) do |ch, stream, data|
0
             case stream
0
             when :out then output << data
0
- when :err then raise CaptureError, "error processing #{command.inspect}: #{data.inspect}"
0
+ when :err then warn "[err :: #{ch[:server]}] #{data}"
0
             end
0
           end
0
           output
...
37
38
39
40
41
42
 
 
 
 
 
 
43
44
45
...
59
60
61
62
63
 
...
37
38
39
 
 
 
40
41
42
43
44
45
46
47
48
...
62
63
64
 
65
66
0
@@ -37,9 +37,12 @@ class ConfigurationActionsInspectTest < Test::Unit::TestCase
0
     @config.capture("hostname", :foo => "bar")
0
   end
0
 
0
- def test_capture_with_stderr_result_should_raise_capture_error
0
- @config.expects(:invoke_command).yields(mock("channel"), :err, "boom")
0
- assert_raises(Capistrano::CaptureError) { @config.capture("hostname") }
0
+ def test_capture_with_stderr_should_emit_stderr_via_warn
0
+ ch = mock("channel")
0
+ ch.expects(:[]).with(:server).returns(server("capistrano"))
0
+ @config.expects(:invoke_command).yields(ch, :err, "boom")
0
+ @config.expects(:warn).with("[err :: capistrano] boom")
0
+ @config.capture("hostname")
0
   end
0
 
0
   def test_capture_with_stdout_should_aggregate_and_return_stdout
0
@@ -59,4 +62,4 @@ class ConfigurationActionsInspectTest < Test::Unit::TestCase
0
       @config.channel = channel
0
       @config.script = output
0
     end
0
-end
0
\ No newline at end of file
0
+end

Comments

    No one has commented yet.