I think you need at least one @async
(see e.g., Collecting all output from shell commands - #7 by tkf), unless there is some kind of a marker from the external process that indicates the end of multi-line response. But, if you need to deal with multiple requests and responses, I don’t think there is a way to reliably relate a chunk of output lines to a response. So, using @async
may not solve the actual problem.