<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Mon, Jan 8, 2018 at 4:03 PM Random832 <<a href="mailto:random832@fastmail.com">random832@fastmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Mon, Jan 8, 2018, at 18:05, Gregory P. Smith wrote:<br>
> i agree with just a list of tuples, but i suggest creating namedtuple<br>
> instances in the posix module for the purpose (one each for close, dup2,<br>
> open) . Don't put a reference to a function in the tuple as Serhiy<br>
> suggested as, while obvious what it means, it gives the wrong impression to<br>
> the user: nothing is calling the Python functions. This is a posix API<br>
> that takes a list of arguments for a specific set of system calls for _it_<br>
> to make for us in a specific order.<br>
<br>
Instead of a sequence of functions to call, it'd be nice if a higher-level API could allow just passing in a mapping of file descriptor numbers to what they should point to in the new process, and the implementation figures out what sequence is necessary to get that result.<br>
<br>
And at that point we could just extend the subprocess API to allow redirection of file descriptors other than 0/1/2, and have an implementation of it in terms of posix_spawn.<br></blockquote><div><br></div><div>sure, but high level APIs don't belong in the os/posix module.</div><div><br></div><div>-gps</div></div></div>