1
1
# Platform-specific subprocess bits'n'pieces.
2
+ from __future__ import annotations
2
3
3
4
import os
4
5
import sys
5
- from typing import TYPE_CHECKING , Optional , Tuple
6
+ from typing import TYPE_CHECKING
6
7
7
8
import trio
8
9
9
10
from .. import _core , _subprocess
10
11
from .._abc import ReceiveStream , SendStream # noqa: TCH001
11
12
12
- _wait_child_exiting_error : Optional [ ImportError ] = None
13
- _create_child_pipe_error : Optional [ ImportError ] = None
13
+ _wait_child_exiting_error : ImportError | None = None
14
+ _create_child_pipe_error : ImportError | None = None
14
15
15
16
16
17
if TYPE_CHECKING :
@@ -26,7 +27,7 @@ def close(self) -> None:
26
27
27
28
# Fallback versions of the functions provided -- implementations
28
29
# per OS are imported atop these at the bottom of the module.
29
- async def wait_child_exiting (process : " _subprocess.Process" ) -> None :
30
+ async def wait_child_exiting (process : _subprocess .Process ) -> None :
30
31
"""Block until the child process managed by ``process`` is exiting.
31
32
32
33
It is invalid to call this function if the process has already
@@ -41,7 +42,7 @@ async def wait_child_exiting(process: "_subprocess.Process") -> None:
41
42
raise NotImplementedError from _wait_child_exiting_error # pragma: no cover
42
43
43
44
44
- def create_pipe_to_child_stdin () -> Tuple [ " ClosableSendStream" , int ]:
45
+ def create_pipe_to_child_stdin () -> tuple [ ClosableSendStream , int ]:
45
46
"""Create a new pipe suitable for sending data from this
46
47
process to the standard input of a child we're about to spawn.
47
48
@@ -54,7 +55,7 @@ def create_pipe_to_child_stdin() -> Tuple["ClosableSendStream", int]:
54
55
raise NotImplementedError from _create_child_pipe_error # pragma: no cover
55
56
56
57
57
- def create_pipe_from_child_output () -> Tuple [ " ClosableReceiveStream" , int ]:
58
+ def create_pipe_from_child_output () -> tuple [ ClosableReceiveStream , int ]:
58
59
"""Create a new pipe suitable for receiving data into this
59
60
process from the standard output or error stream of a child
60
61
we're about to spawn.
0 commit comments