Fix issues in queue name completion code.

- Read the output line-by-line instead of reading into a big string.
- Handle errors in line format more smoothly.