I've tried readLine() and readData() but both seem to wait for the stream to have data to read.
How do I only read data when it's available?
You can use hasData(p: Process): bool to query if there is data available. https://nim-lang.org/docs/osproc.html#hasData,Process
I want to echo the output stream contents only as they are available.
You can do that with poParentStreams ProcessOption, but you cannot read output stream.
Stream returned from outputStream(p: Process) proc cannot perform peek operation. https://nim-lang.org/docs/osproc.html#outputStream,Process
Stream returned from peekableOutputStream(p: Process) proc can perform peek operation, but it blocks if no data available. Becuase: https://github.com/nim-lang/Nim/pull/14949