Skip to content

Commit 9047e3e

Browse files
committed
Potential fix for issue defunkt#58
1 parent 7c7ea5d commit 9047e3e

File tree

1 file changed

+4
-19
lines changed

1 file changed

+4
-19
lines changed

lib/cijoe.rb

+4-19
Original file line numberDiff line numberDiff line change
@@ -93,20 +93,6 @@ def build(branch=nil)
9393
Thread.new { build!(branch) }
9494
end
9595

96-
def open_pipe(cmd)
97-
read, write = IO.pipe
98-
99-
pid = fork do
100-
read.close
101-
$stdout.reopen write
102-
exec cmd
103-
end
104-
105-
write.close
106-
107-
yield read, pid
108-
end
109-
11096
# update git then run the build
11197
def build!(branch=nil)
11298
@git_branch = branch
@@ -117,12 +103,11 @@ def build!(branch=nil)
117103
build.branch = git_branch
118104
write_build 'current', build
119105

120-
open_pipe("cd #{@project_path} && #{runner_command} 2>&1") do |pipe, pid|
121-
puts "#{Time.now.to_i}: Building #{build.branch} at #{build.short_sha}: pid=#{pid}"
122-
123-
build.pid = pid
106+
IO.popen("cd #{@project_path} && #{runner_command} 2>&1") do |io|
107+
puts "#{Time.now.to_i}: Building #{build.branch} at #{build.short_sha}: pid=#{io.pid}"
108+
output = io.read
109+
build.pid = io.pid
124110
write_build 'current', build
125-
output = pipe.read
126111
end
127112

128113
Process.waitpid(build.pid, 1)

0 commit comments

Comments
 (0)