[Python-Dev] Best Python API for exposing posix_spawn (original) (raw)
Gregory P. Smith greg at krypto.org
Mon Jan 8 19:51:30 EST 2018
- Previous message (by thread): [Python-Dev] Best Python API for exposing posix_spawn
- Next message (by thread): [Python-Dev] Best Python API for exposing posix_spawn
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Mon, Jan 8, 2018 at 4:03 PM Random832 <random832 at 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 posixspawn.
sure, but high level APIs don't belong in the os/posix module.
-gps -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20180109/0aea3e9d/attachment.html>
- Previous message (by thread): [Python-Dev] Best Python API for exposing posix_spawn
- Next message (by thread): [Python-Dev] Best Python API for exposing posix_spawn
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]