-
-
Notifications
You must be signed in to change notification settings - Fork 33.3k
Closed
Labels
Description
Documentation
I was trying to write some asyncio subprocess code to pipe from one process to another, struggled until I found examples with os.pipe(). But going back to the docs I was confused because passing a filehandle isn't mentioned as an option. Looking at the underlying code, I see it definitely is supported, there's a check for the parameter being an integer and the handle is used directly.
The incorrect documentation is here
cpython/Doc/library/asyncio-eventloop.rst
Lines 1439 to 1469 in 101d5ec
| * *stdin* can be any of these: | |
| * a file-like object | |
| * the :const:`subprocess.PIPE` constant (default) which will create a new | |
| pipe and connect it, | |
| * the value ``None`` which will make the subprocess inherit the file | |
| descriptor from this process | |
| * the :const:`subprocess.DEVNULL` constant which indicates that the | |
| special :data:`os.devnull` file will be used | |
| * *stdout* can be any of these: | |
| * a file-like object | |
| * the :const:`subprocess.PIPE` constant (default) which will create a new | |
| pipe and connect it, | |
| * the value ``None`` which will make the subprocess inherit the file | |
| descriptor from this process | |
| * the :const:`subprocess.DEVNULL` constant which indicates that the | |
| special :data:`os.devnull` file will be used | |
| * *stderr* can be any of these: | |
| * a file-like object | |
| * the :const:`subprocess.PIPE` constant (default) which will create a new | |
| pipe and connect it, | |
| * the value ``None`` which will make the subprocess inherit the file | |
| descriptor from this process | |
| * the :const:`subprocess.DEVNULL` constant which indicates that the | |
| special :data:`os.devnull` file will be used | |
| * the :const:`subprocess.STDOUT` constant which will connect the standard | |
| error stream to the process' standard output stream |
So instead of
* *stdin* can be any of these:
* a file-like object
* the :const:`subprocess.PIPE` constant (default) which will create a new
pipe and connect it,...
I'd suggest:
* *stdin* can be any of these:
* a file-like object
* an existing file descriptor (a positive integer), for example those created with :meth:`os.pipe()`,
* the :const:`subprocess.PIPE` constant (default) which will create a new
pipe and connect it,...
(and similarly for stdout and stderr)
Linked PRs
Metadata
Metadata
Assignees
Labels
Projects
Status
Done