r"""Execute a child program in a new process. After construction, you can interact with the child process by writing data to its `~trio.Process.stdin` stream (a `~trio.abc.SendStream`), reading data from its `~trio.Process.stdout` and/or `~trio.Process.stderr` streams (both `~trio.a
(
command: StrOrBytesPath | Sequence[StrOrBytesPath],
*,
stdin: int | HasFileno | None = None,
stdout: int | HasFileno | None = None,
stderr: int | HasFileno | None = None,
**options: object,
)
| 304 | |
| 305 | |
| 306 | async def _open_process( |
| 307 | command: StrOrBytesPath | Sequence[StrOrBytesPath], |
| 308 | *, |
| 309 | stdin: int | HasFileno | None = None, |
| 310 | stdout: int | HasFileno | None = None, |
| 311 | stderr: int | HasFileno | None = None, |
| 312 | **options: object, |
| 313 | ) -> Process: |
| 314 | r"""Execute a child program in a new process. |
| 315 | |
| 316 | After construction, you can interact with the child process by writing data to its |
| 317 | `~trio.Process.stdin` stream (a `~trio.abc.SendStream`), reading data from its |
| 318 | `~trio.Process.stdout` and/or `~trio.Process.stderr` streams (both |
| 319 | `~trio.abc.ReceiveStream`\s), sending it signals using `~trio.Process.terminate`, |
| 320 | `~trio.Process.kill`, or `~trio.Process.send_signal`, and waiting for it to exit |
| 321 | using `~trio.Process.wait`. See `trio.Process` for details. |
| 322 | |
| 323 | Each standard stream is only available if you specify that a pipe should be created |
| 324 | for it. For example, if you pass ``stdin=subprocess.PIPE``, you can write to the |
| 325 | `~trio.Process.stdin` stream, else `~trio.Process.stdin` will be ``None``. |
| 326 | |
| 327 | Unlike `trio.run_process`, this function doesn't do any kind of automatic |
| 328 | management of the child process. It's up to you to implement whatever semantics you |
| 329 | want. |
| 330 | |
| 331 | Args: |
| 332 | command: The command to run. Typically this is a sequence of strings or |
| 333 | bytes such as ``['ls', '-l', 'directory with spaces']``, where the |
| 334 | first element names the executable to invoke and the other elements |
| 335 | specify its arguments. With ``shell=True`` in the ``**options``, or on |
| 336 | Windows, ``command`` can be a string or bytes, which will be parsed |
| 337 | following platform-dependent :ref:`quoting rules |
| 338 | <subprocess-quoting>`. In all cases ``command`` can be a path or a |
| 339 | sequence of paths. |
| 340 | stdin: Specifies what the child process's standard input |
| 341 | stream should connect to: output written by the parent |
| 342 | (``subprocess.PIPE``), nothing (``subprocess.DEVNULL``), |
| 343 | or an open file (pass a file descriptor or something whose |
| 344 | ``fileno`` method returns one). If ``stdin`` is unspecified, |
| 345 | the child process will have the same standard input stream |
| 346 | as its parent. |
| 347 | stdout: Like ``stdin``, but for the child process's standard output |
| 348 | stream. |
| 349 | stderr: Like ``stdin``, but for the child process's standard error |
| 350 | stream. An additional value ``subprocess.STDOUT`` is supported, |
| 351 | which causes the child's standard output and standard error |
| 352 | messages to be intermixed on a single standard output stream, |
| 353 | attached to whatever the ``stdout`` option says to attach it to. |
| 354 | **options: Other :ref:`general subprocess options <subprocess-options>` |
| 355 | are also accepted. |
| 356 | |
| 357 | Returns: |
| 358 | A new `trio.Process` object. |
| 359 | |
| 360 | Raises: |
| 361 | OSError: if the process spawning fails, for example because the |
| 362 | specified command could not be found. |
| 363 |
no test coverage detected
searching dependent graphs…