Skip to content

Commit

Permalink
Stop using deprecated get_event_loop() (#86)
Browse files Browse the repository at this point in the history
Co-authored-by: Sorin Sbarnea <ssbarnea@redhat.com>
  • Loading branch information
gotmax23 and ssbarnea authored Dec 16, 2022
1 parent 0b13abb commit 0352a03
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/subprocess_tee/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def tee_func(line: bytes, sink: List[str], pipe: Optional[Any]) -> None:
else:
print(line_str)

loop = asyncio.get_event_loop_policy().get_event_loop()
loop = asyncio.get_running_loop()
tasks = []
if process.stdout:
tasks.append(
Expand Down Expand Up @@ -143,8 +143,7 @@ def run(args: Union[str, List[str]], **kwargs: Any) -> CompletedProcess:
if kwargs.get("echo", False):
print(f"COMMAND: {cmd}")

loop = asyncio.get_event_loop_policy().get_event_loop()
result = loop.run_until_complete(_stream_subprocess(cmd, **kwargs))
result = asyncio.run(_stream_subprocess(cmd, **kwargs))
# we restore original args to mimic subproces.run()
result.args = args

Expand Down

0 comments on commit 0352a03

Please sign in to comment.