On Tue, Feb 19, 2013 at 11:00 AM, Idan Kamara <span dir="ltr"><<a href="mailto:idankk86@gmail.com" target="_blank">idankk86@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">And here you're waiting for it to finish, but what happens<br>if for some reason one of the previous children fails first?<br></div></blockquote><div><br></div><div>os.wait waits for any process to finish. None of the values in the list of pids is used in that loop.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Why not use select on the children and also spare the thread?</div><div class="yj6qo"></div>
<div class="adL">
</div></blockquote></div><br>select works on file descriptors, not pids. We need some mechanism to catch early-exiting children immediately. We could possibly do that by having a pipe per child and detect EOF on each pipe, but that's way more work. (It might turn out to be necessary at some point, e.g. for Windows, but I don't want to further complicate the code until I know that said complexity is necessary.)