Skip to content

Commit

Permalink
call correct asyncio loop function, closes #683
Browse files Browse the repository at this point in the history
  • Loading branch information
amoffat committed Aug 7, 2023
1 parent 5f9f2ac commit 60445c7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 2.0.5 -

- Allow nested `with` contexts [#690](https://github.com/amoffat/sh/issues/690)
- Call correct asyncio function for getting event loop [#683](https://github.com/amoffat/sh/issues/683)

## 2.0.4 - 5/13/22

Expand Down
4 changes: 2 additions & 2 deletions sh.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ def __init__(self, cmd, call_args, stdin, stdout, stderr):
# this event is used when we want to `await` a RunningCommand. see how it gets
# used in self.__await__
try:
asyncio.get_event_loop()
asyncio.get_running_loop()
except RuntimeError:
self.aio_output_complete = None
else:
Expand Down Expand Up @@ -2383,7 +2383,7 @@ def fn(exit_code):
# if the `sh` command was launched from within a thread (so we're not in
# the main thread), then we won't have an event loop.
try:
loop = asyncio.get_event_loop()
loop = asyncio.get_running_loop()
except RuntimeError:

def output_complete():
Expand Down

0 comments on commit 60445c7

Please sign in to comment.