It may not be an issue for the cases you are dealing with, but what if the command you run produces enough output to STDERR to fill the pipe before it closes STDOUT, and blocks writing STDERR. Then you will be stuck in the loop on STDOUT, waiting for that to finish, never reading STDERR, and the command will never finish because it is waiting to write to STDERR - deadlock.
You might have a look at select.
In reply to Re: Open3 doesn't work in a sub-routine
by ig
in thread Open3 doesn't work in a sub-routine
by sirohia
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |