summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/subprocess.py
Commit message (Collapse)AuthorAgeFilesLines
* gh-109709: Fix asyncio test_stdin_broken_pipe() (#109710)Victor Stinner2023-09-221-6/+8
| | | | | | Replace harcoded sleep of 500 ms with synchronization using a pipe. Fix also Process._feed_stdin(): catch also BrokenPipeError on stdin.write(input), not only on stdin.drain().
* gh-104340: Suppress warning about unawaited exception for closed pipe stdin ↵Guido van Rossum2023-05-171-0/+3
| | | | (#104586)
* gh-83925: Make asyncio.subprocess communicate similar to non-asyncio (#18650)Marek Marczykowski-Górecki2023-04-281-5/+6
| | | | | | | subprocess's communicate(None) closes stdin of the child process, after sending no (extra) data. Make asyncio variant do the same. This fixes issues with processes that waits for EOF on stdin before continuing.
* bpo-42392: Remove loop parameter from asyncio.tasks and asyncio.subprocess ↵Yurii Karabas2020-11-281-24/+6
| | | | (GH-23521)
* bpo-38242: Revert "bpo-36889: Merge asyncio streams (GH-13251)" (#16482)Yury Selivanov2019-09-301-43/+21
| | | See https://bugs.python.org/issue38242 for more details
* bpo-36373: Deprecate explicit loop in task and subprocess API (GH-16033)Andrew Svetlov2019-09-121-0/+13
|
* bpo-38066: Hide internal Stream methods (GH-15762)Andrew Svetlov2019-09-101-5/+5
| | | | | | feed_eof(), feed_data(), set_exception(), and set_transport() are prefixed with underscore now. https://bugs.python.org/issue38066
* Fix typos in comments, docs and test names (#15018)Min ho Kim2019-07-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | * Fix typos in comments, docs and test names * Update test_pyparse.py account for change in string length * Apply suggestion: splitable -> splittable Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu> * Apply suggestion: splitable -> splittable Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu> * Apply suggestion: Dealloccte -> Deallocate Co-Authored-By: Terry Jan Reedy <tjreedy@udel.edu> * Update posixmodule checksum. * Reverse idlelib changes.
* bpo-36889: Merge asyncio streams (GH-13251)Andrew Svetlov2019-05-271-12/+23
| | | https://bugs.python.org/issue36889
* bpo-36801: Fix waiting in StreamWriter.drain for closing SSL transport ↵Andrew Svetlov2019-05-071-0/+9
| | | | | (GH-13098) https://bugs.python.org/issue36801
* Forbid creating of stream objects outside of asyncio (#13101)Andrew Svetlov2019-05-071-10/+22
|
* bpo-35065: Remove `StreamReaderProtocol._untrack_reader` (#10212)Vincent Michel2018-11-081-5/+0
| | | | | The call to `_untrack_reader` is performed too soon, causing the protocol to forget about the reader before `connection_lost` can run and feed the EOF to the reader. See bpo-35065.
* bpo-34638: Store a weak reference to stream reader to break strong ↵Andrew Svetlov2018-09-121-0/+5
| | | | | | | | references loop (GH-9201) Store a weak reference to stream readerfor breaking strong references It breaks the strong reference loop between reader and protocol and allows to detect and close the socket if the stream is deleted (garbage collected)
* bpo-32262: Fix codestyle; use f-strings formatting where necessary. (#4775)Yury Selivanov2017-12-101-9/+9
|
* bpo-32193: Convert asyncio to async/await usage (#4753)Andrew Svetlov2017-12-081-36/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Convert asyncio/tasks.py to async/await * Convert asyncio/queues.py to async/await * Convert asyncio/test_utils.py to async/await * Convert asyncio/base_subprocess.py to async/await * Convert asyncio/subprocess.py to async/await * Convert asyncio/streams.py to async/await * Fix comments * Convert asyncio/locks.py to async/await * Convert asyncio.sleep to async def * Add a comment * Add missing news * Convert stubs from AbstrctEventLoop to async functions * Convert subprocess_shell/subprocess_exec * Convert connect_read_pipe/connect_write_pip to async/await syntax * Convert create_datagram_endpoint * Convert create_unix_server/create_unix_connection * Get rid of old style coroutines in unix_events.py * Convert selector_events.py to async/await * Convert wait_closed and create_connection * Drop redundant line * Convert base_events.py * Code cleanup * Drop redundant comments * Fix indentation * Add explicit tests for compatibility between old and new coroutines * Convert windows event loop to use async/await * Fix double awaiting of async function * Convert asyncio/locks.py * Improve docstring * Convert tests to async/await * Convert more tests * Convert more tests * Convert more tests * Convert tests * Improve test
* asyncio: Fix trailing whitespace/code styleYury Selivanov2017-03-031-2/+2
|
* bpo-29704: Fix asyncio.SubprocessStreamProtocol closing (#405)Seth M. Larson2017-03-031-2/+15
|
* Issue #26848: Fix asyncio/subprocess.communicate() to handle empty input.Yury Selivanov2016-05-131-1/+1
|
* asyncio: sync with githubVictor Stinner2015-07-251-2/+0
| | | | | | | | | * Fix ResourceWarning warnings in test_streams * Return True from StreamReader.eof_received() to fix http://bugs.python.org/issue24539 (but still needs a unittest). Add StreamReader.__repr__() for easy debugging. * remove unused imports * Issue #234: Drop JoinableQueue on Python 3.5+
* Issue #23347, asyncio: Make BaseSubprocessTransport.wait() privateVictor Stinner2015-01-291-1/+1
|
* asyncio: sync with TulipVictor Stinner2015-01-291-37/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Issue #23347: send_signal(), kill() and terminate() methods of BaseSubprocessTransport now check if the transport was closed and if the process exited. Issue #23347: Refactor creation of subprocess transports. Changes on BaseSubprocessTransport: * Add a wait() method to wait until the child process exit * The constructor now accepts an optional waiter parameter. The _post_init() coroutine must not be called explicitly anymore. It makes subprocess transports closer to other transports, and it gives more freedom if we want later to change completly how subprocess transports are created. * close() now kills the process instead of kindly terminate it: the child process may ignore SIGTERM and continue to run. Call explicitly terminate() and wait() if you want to kindly terminate the child process. * close() now logs a warning in debug mode if the process is still running and needs to be killed * _make_subprocess_transport() is now fully asynchronous again: if the creation of the transport failed, wait asynchronously for the process eixt. Before the wait was synchronous. This change requires close() to *kill*, and not terminate, the child process. * Remove the _kill_wait() method, replaced with a more agressive close() method. It fixes _make_subprocess_transport() on error. BaseSubprocessTransport.close() calls the close() method of pipe transports, whereas _kill_wait() closed directly pipes of the subprocess.Popen object without unregistering file descriptors from the selector (which caused severe bugs). These changes simplifies the code of subprocess.py.
* Issue #23242: asyncio.SubprocessStreamProtocol now closes the subprocessVictor Stinner2015-01-151-1/+4
| | | | | | transport at subprocess exit. Clear also its reference to the transport.
* Python issue #23173: sync with TulipVictor Stinner2015-01-141-3/+13
| | | | | | | | * If an exception is raised during the creation of a subprocess, kill the subprocess (close pipes, kill and read the return status). Log an error in such case. * Fix SubprocessStreamProtocol.connection_made() to handle cancelled waiter. Add unit test cancelling subprocess methods.
* Issue #23140, asyncio: Fix cancellation of Process.wait(). Check the state ofVictor Stinner2015-01-061-1/+2
| | | | the waiter future before setting its result.
* Closes #22685, asyncio: Set the transport of stdout and stderr StreamReaderVictor Stinner2014-11-251-5/+12
| | | | | objects in the SubprocessStreamProtocol. It allows to pause the transport to not buffer too much stdout or stderr data.
* asyncio, tulip issue 190: Process.communicate() now ignoresVictor Stinner2014-07-171-5/+7
| | | | ConnectionResetError too
* asyncio, tulip issue 190: Process.communicate() must ignore BrokenPipeErrorVictor Stinner2014-07-171-1/+5
| | | | | | | | If you want to handle the BrokenPipeError, you can easily reimplement communicate(). Add also a unit test to ensure that stdin.write() + stdin.drain() raises BrokenPipeError.
* asyncio: sync with TulipVictor Stinner2014-07-141-0/+26
| | | | | | | | | | | | | | | | | | | | * Tulip issue #184: Log subprocess events in debug mode - Log stdin, stdout and stderr transports and protocols - Log process identifier (pid) - Log connection of pipes - Log process exit - Log Process.communicate() tasks: feed stdin, read stdout and stderr - Add __repr__() method to many classes related to subprocesses * Add BaseSubprocessTransport._pid attribute. Store the pid so it is still accessible after the process exited. It's more convinient for debug. * create_connection(): add the socket in the "connected to" debug log * Clean up some docstrings and comments. Remove unused unimplemented _read_from_self().
* asyncio: sync with Tulip, add a new asyncio.coroutines moduleVictor Stinner2014-06-281-7/+8
|
* asyncio.subprocess: Fix a race condition in communicate()Victor Stinner2014-02-201-2/+1
| | | | | Use self._loop instead of self._transport._loop, because transport._loop is set to None at process exit.
* asyncio: pep8-ify the code.Yury Selivanov2014-02-191-2/+3
|
* asyncio, Tulip issue 130: Add more checks on subprocess_exec/subprocess_shellVictor Stinner2014-02-111-2/+3
| | | | parameters
* asyncio: Remove Process.subprocess attribute; it's too easy to get inconsistentVictor Stinner2014-02-091-4/+0
| | | | Process and Popen objects
* asyncio.subprocess: Replace Process.get_subprocess() method with aVictor Stinner2014-02-031-1/+2
| | | | Process.subprocess read-only property
* Issue #20400: Merge Tulip into Python: add the new asyncio.subprocess moduleVictor Stinner2014-02-011-0/+197
* Add a new asyncio.subprocess module * Add new create_subprocess_exec() and create_subprocess_shell() functions * The new asyncio.subprocess.SubprocessStreamProtocol creates stream readers for stdout and stderr and a stream writer for stdin. * The new asyncio.subprocess.Process class offers an API close to the subprocess.Popen class: - pid, returncode, stdin, stdout and stderr attributes - communicate(), wait(), send_signal(), terminate() and kill() methods * Remove STDIN (0), STDOUT (1) and STDERR (2) constants from base_subprocess and unix_events, to not be confused with the symbols with the same name of subprocess and asyncio.subprocess modules * _ProactorBasePipeTransport.get_write_buffer_size() now counts also the size of the pending write * _ProactorBaseWritePipeTransport._loop_writing() may now pause the protocol if the write buffer size is greater than the high water mark (64 KB by default)