mirror of
https://github.com/status-im/nim-chronos.git
synced 2025-02-22 16:08:23 +00:00
Fix wait() to allow Future[void].
This commit is contained in:
parent
51c87bf090
commit
7d63a1b54d
@ -767,6 +767,9 @@ proc wait*[T](fut: Future[T], timeout = InfiniteDuration): Future[T] =
|
||||
if not retFuture.finished:
|
||||
if fut.failed:
|
||||
retFuture.fail(fut.error)
|
||||
else:
|
||||
when T is void:
|
||||
retFuture.complete()
|
||||
else:
|
||||
retFuture.complete(fut.read())
|
||||
if timeout.isInfinite():
|
||||
@ -775,6 +778,9 @@ proc wait*[T](fut: Future[T], timeout = InfiniteDuration): Future[T] =
|
||||
if fut.finished:
|
||||
if fut.failed:
|
||||
retFuture.fail(fut.error)
|
||||
else:
|
||||
when T is void:
|
||||
retFuture.complete()
|
||||
else:
|
||||
retFuture.complete(fut.read())
|
||||
else:
|
||||
|
Loading…
x
Reference in New Issue
Block a user