Permalink
Browse files

Merge pull request #84 from tansengming/master

fixed the CLI to exit with a non-zero status whenever deployment fails
  • Loading branch information...
2 parents 50b8102 + 7e37d61 commit 779d67c56fe8e588a2a3f25c9d7a3d653aacf706 Gabe Berke-Williams committed Mar 2, 2012
Showing with 11 additions and 5 deletions.
  1. +1 −0 lib/kumade/cli.rb
  2. +10 −5 spec/kumade/cli_spec.rb
View
@@ -34,6 +34,7 @@ def self.swapping_stdout_for(io, print_output = false)
rescue Kumade::DeploymentError
io.rewind
real_stdout.print(io.read)
+ exit 1
ensure
$stdout = real_stdout
end
View
@@ -89,13 +89,18 @@
output.read.should == "Hello, you can't see me.\n"
end
- it 'dumps the output stash to real stdout when an error happens' do
- Kumade::CLI.swapping_stdout_for(output) do
- $stdout.puts "Hello, you can see me!"
- raise Kumade::DeploymentError.new("error")
+ context 'when print_output is false' do
+ subject do
+ Kumade::CLI.swapping_stdout_for(output) do
+ $stdout.puts "Hello, you can see me!"
+ raise Kumade::DeploymentError.new("error")
+ end
end
- stdout.should have_received(:print).with("Hello, you can see me!\n")
+ it 'dumps the output stash to real stdout when an error happens, exits with non-zero status' do
+ expect { subject }.should raise_error SystemExit
+ stdout.should have_received(:print).with("Hello, you can see me!\n")
+ end
end
context "in print output mode" do

0 comments on commit 779d67c

Please sign in to comment.