Skip to content

Commit

Permalink
Merge pull request AdaCore#684 from leocardao/mr/cardao/fix-typing
Browse files Browse the repository at this point in the history
Fix e3.os.process typing
  • Loading branch information
leocardao authored Mar 21, 2024
2 parents b80bcdc + 14cc2a2 commit 2cb9646
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/e3/os/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@
from e3.os.fs import which
from e3.text import bytes_as_str


if TYPE_CHECKING:
from typing import cast, Any, IO, List, Literal, NoReturn, Union
from typing import cast, Any, IO, Literal, NoReturn, Union

CmdLine = List[str]
AnyCmdLine = Union[List[CmdLine], CmdLine]
CmdLine = list[str]
AnyCmdLine = Union[list[CmdLine], CmdLine]
STDOUT_VALUE = Literal[-1]
PIPE_VALUE = Literal[-2]
DEVNULL_VALUE = Literal[-3]
Expand Down Expand Up @@ -671,12 +670,11 @@ def __init__(self, name: Any, mode: str = "r"):
# this is a file descriptor
self.fd = name

def get_command(self) -> str | None:
def get_command(self) -> str | bytes | None:
"""Return the command to run to create the pipe."""
if self.fd == subprocess.PIPE:
if self.fd == subprocess.PIPE and isinstance(self.name, (str, bytes)):
return self.name[1:]
else:
return None
return None

def close(self) -> None:
"""Close the file if needed."""
Expand Down

0 comments on commit 2cb9646

Please sign in to comment.