Commit 62550d8a authored by Samuel E. Giddins's avatar Samuel E. Giddins

[Executable] Use popen3 instead of open4 to execute commands

parent 3d184acc
......@@ -77,7 +77,6 @@ PATH
escape (~> 0.0.4)
molinillo (~> 0.2.3)
nap (~> 0.8)
open4 (~> 1.3)
xcodeproj (~> 0.24.0)
GEM
......@@ -124,7 +123,6 @@ GEM
nap (0.8.0)
netrc (0.7.8)
notify (0.5.2)
open4 (1.3.4)
parser (2.2.0.3)
ast (>= 1.1, < 3.0)
powerpack (0.1.0)
......
......@@ -38,7 +38,6 @@ Gem::Specification.new do |s|
s.add_runtime_dependency 'colored', '~> 1.2'
s.add_runtime_dependency 'escape', '~> 0.0.4'
s.add_runtime_dependency 'open4', '~> 1.3'
s.add_runtime_dependency 'activesupport', '>= 3.2.15'
s.add_runtime_dependency 'nap', '~> 0.8'
......
......@@ -51,7 +51,7 @@ module Pod
bin = `which #{executable}`.strip
raise Informative, "Unable to locate the executable `#{executable}`" if bin.empty?
require 'open4'
require 'open3'
require 'shellwords'
command = command.map(&:to_s)
......@@ -64,8 +64,13 @@ module Pod
stdout, stderr = Indenter.new, Indenter.new
end
options = { :stdout => stdout, :stderr => stderr, :status => true }
status = Open4.spawn(bin, command, options)
status = Open3.popen3(bin, *command) do |i, o, e, t|
out_reader = Thread.new { while s = o.gets; stdout << s; end }
err_reader = Thread.new { while s = e.gets; stderr << s; end }
i.close
[out_reader, err_reader].each(&:join)
t.value
end
output = stdout.join("\n") + stderr.join("\n")
unless status.success?
if raise_on_failure
......
......@@ -16,7 +16,7 @@ module Pod
result = mock
result.stubs(:success?).returns(true)
Open4.expects(:spawn).with('/Spa ces/are"/fun/false', [], :stdout => [], :stderr => [], :status => true).once.returns(result)
Open3.expects(:popen3).with('/Spa ces/are"/fun/false').once.returns(result)
Executable.execute_command(cmd, [], true)
end
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment