Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' of github.com:customink/strainer
Browse files Browse the repository at this point in the history
  • Loading branch information
sethvargo committed Jan 24, 2013
2 parents 6361053 + d4f703f commit 8a7d7f0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ v1.0.0
- Moved entirely to Berkshelf integration
- Moved entirely to thor
- **Breaking** - new command `strainer`, old command is deprecated and will be removed in `2.0.0`
- Sync output

v0.2.1
------
Expand Down
14 changes: 13 additions & 1 deletion lib/strainer/command.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'pty'

module Strainer
# The Command class is responsible for a command (test) against a cookbook.
#
Expand Down Expand Up @@ -33,7 +35,17 @@ def run!

Dir.chdir Strainer.sandbox_path do
speak command
speak `#{command}`
PTY.spawn command do |r, _, pid|
begin
r.sync
r.each_line { |line| speak line }
rescue Errno::EIO => e
# Ignore this. Otherwise errors will be thrown whenever
# the process is closed
ensure
::Process.wait pid
end
end

unless $?.success?
Strainer.ui.error label_with_padding + Strainer.ui.set_color('Terminated with a non-zero exit status. Strainer assumes this is a failure.', :red)
Expand Down

0 comments on commit 8a7d7f0

Please sign in to comment.