For a GUI tool I'm writing in Rust I'd like to kick off long-lived subprocesses and then repeatedly poll them for output. I don't want to block indefinitely waiting for output from any given one, so I'm using tokio and tokio-process to run the process and timeout the output reading. I need to store the subprocess in a struct as well.

I'm running into problems because it seems I need to consume the subprocess's output stream in order to read from it, so after a single read I'm unable to access it again.

I've included a simplified reproduction of my problem below. It prints actual output for the first invocation of print_output , but then prints No process_output_fut for the second invocation since I had to take the output future out of the Plugin struct and consume it in order to read from it.

Any suggestions for how to refactor this code to avoid consuming the process output future with each attempt to fetch the output?