In the "multiple commands" case, you nead to read as many lines as you sent commands.
Otherwise it's gonna work (well). You're going to choke your input pipe with as you'd be expeting less responses than what you'd get.

Honestly I'd handle this as a separate method, `send_multiple_commands_and_get_results`, then (possibly) refactor.