(original) (raw)
On Mon, Jan 8, 2018 at 4:03 PM Random832 <random832@fastmail.com> wrote:
On Mon, Jan 8, 2018, at 18:05, Gregory P. Smith wrote:
\> i agree with just a list of tuples, but i suggest creating namedtuple
\> instances in the posix module for the purpose (one each for close, dup2,
\> open) . Don't put a reference to a function in the tuple as Serhiy
\> suggested as, while obvious what it means, it gives the wrong impression to
\> the user: nothing is calling the Python functions. This is a posix API
\> that takes a list of arguments for a specific set of system calls for \_it\_
\> to make for us in a specific order.
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.
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.
sure, but high level APIs don't belong in the os/posix module.
-gps