blob: 54db9d8e2d5d282cdaa965d2df7bc4065f675281 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#
# monkeypatch CouchRest::Streamer to fix
# https://github.com/couchrest/couchrest/pull/104
#
module CouchRest
class Streamer
def open_pipe(cmd, &block)
first = nil
prev = nil
IO.popen(cmd) do |f|
while line = f.gets
row = parse_line(line)
if row.nil?
first ||= line # save the header for later if we can't parse it.
else
block.call row
end
prev = line
end
end
raise RestClient::ServerBrokeConnection if $? && $?.exitstatus != 0
parse_first(first, prev)
end
end
end
|