R
ritchie
hi
I'm using popen3 to query a database. I'm returning 20 records but I'm
only getting 5 back. The command executed is a simple psql query to a
pg database so there's not much room for error there. Is there some
kind of timeout or fixed buffer size when using popen3? Thanks for any
help.
Here's some relevant code:
records = []
headings = []
Commands.session.process.popen3( "sudo bin/get_account" ) { |i,o,e|
x = o.read
puts x
lines = x.split("\n")
lines.each_with_index { |l,i|
fields = l.split("|")
if i == 0
headings = fields
else
if i != 1 # got a line
records << fields
end
end
#puts "line #{i}, fields #{records}"
}
puts "number of lines is #{lines.length}"
}
tw = headings.length
th = records.length
I'm using popen3 to query a database. I'm returning 20 records but I'm
only getting 5 back. The command executed is a simple psql query to a
pg database so there's not much room for error there. Is there some
kind of timeout or fixed buffer size when using popen3? Thanks for any
help.
Here's some relevant code:
records = []
headings = []
Commands.session.process.popen3( "sudo bin/get_account" ) { |i,o,e|
x = o.read
puts x
lines = x.split("\n")
lines.each_with_index { |l,i|
fields = l.split("|")
if i == 0
headings = fields
else
if i != 1 # got a line
records << fields
end
end
#puts "line #{i}, fields #{records}"
}
puts "number of lines is #{lines.length}"
}
tw = headings.length
th = records.length