Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

cli exits with non-zero status when deploy fails

  • Loading branch information...
commit 0ee8a6469fb66365c945805fb672813df86d0fef 1 parent 81eb06c
@tansengming tansengming authored
Showing with 11 additions and 5 deletions.
  1. +1 −0  lib/kumade/cli.rb
  2. +10 −5 spec/kumade/cli_spec.rb
View
1  lib/kumade/cli.rb
@@ -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
15 spec/kumade/cli_spec.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.