@@ -2,7 +2,7 @@ import subprocess
2
2
import sys
3
3
from _typeshed import Self
4
4
from types import TracebackType
5
- from typing import Callable , Protocol
5
+ from typing import Any , AnyStr , Callable , Protocol
6
6
from typing_extensions import Literal
7
7
8
8
if sys .platform == "win32" :
@@ -36,3 +36,28 @@ if sys.platform == "win32":
36
36
def handle (self ) -> int : ...
37
37
def fileno (self ) -> int : ...
38
38
def close (self , * , CloseHandle : Callable [[int ], None ] = ...) -> None : ...
39
+
40
+ class Popen (subprocess .Popen [AnyStr ]):
41
+ stdin : PipeHandle | None # type: ignore[assignment]
42
+ stdout : PipeHandle | None # type: ignore[assignment]
43
+ stderr : PipeHandle | None # type: ignore[assignment]
44
+ # For simplicity we omit the full overloaded __new__ signature of
45
+ # subprocess.Popen. The arguments are mostly the same, but
46
+ # subprocess.Popen takes other positional-or-keyword arguments before
47
+ # stdin.
48
+ def __new__ (
49
+ cls : type [Self ],
50
+ args : subprocess ._CMD ,
51
+ stdin : subprocess ._FILE | None = ...,
52
+ stdout : subprocess ._FILE | None = ...,
53
+ stderr : subprocess ._FILE | None = ...,
54
+ ** kwds : Any ,
55
+ ) -> Self : ...
56
+ def __init__ (
57
+ self ,
58
+ args : subprocess ._CMD ,
59
+ stdin : subprocess ._FILE | None = ...,
60
+ stdout : subprocess ._FILE | None = ...,
61
+ stderr : subprocess ._FILE | None = ...,
62
+ ** kwds : Any ,
63
+ ) -> None : ...
0 commit comments