Permalink
Browse files

Refactor method.

  • Loading branch information...
1 parent fda26ee commit 39c0a322a2b522836bbb0cacbc201cb3bf054ecd @gabebw gabebw committed Sep 9, 2011
Showing with 10 additions and 8 deletions.
  1. +10 −8 lib/kumade/cli.rb
View
@@ -50,17 +50,19 @@ def self.parse_arguments!(args)
end
def self.swapping_stdout_for(io)
- begin
- $real_stdout = $stdout
- $stdout = io unless pretending?
+ if pretending?
yield
- rescue Kumade::DeploymentError
- unless pretending?
+ else
+ begin
+ real_stdout = $stdout
+ $stdout = io
+ yield
+ rescue Kumade::DeploymentError
io.rewind
- $real_stdout.print(io.read)
+ real_stdout.print(io.read)
+ ensure
+ $stdout = real_stdout
end
- ensure
- $stdout = $real_stdout
end
end

0 comments on commit 39c0a32

Please sign in to comment.