mirror of
https://github.com/status-im/nim-chronos.git
synced 2025-02-21 23:48:15 +00:00
Fix wait() to allow Future[void].
This commit is contained in:
parent
51c87bf090
commit
7d63a1b54d
@ -768,7 +768,10 @@ proc wait*[T](fut: Future[T], timeout = InfiniteDuration): Future[T] =
|
||||
if fut.failed:
|
||||
retFuture.fail(fut.error)
|
||||
else:
|
||||
retFuture.complete(fut.read())
|
||||
when T is void:
|
||||
retFuture.complete()
|
||||
else:
|
||||
retFuture.complete(fut.read())
|
||||
if timeout.isInfinite():
|
||||
retFuture = fut
|
||||
elif timeout.isZero():
|
||||
@ -776,7 +779,10 @@ proc wait*[T](fut: Future[T], timeout = InfiniteDuration): Future[T] =
|
||||
if fut.failed:
|
||||
retFuture.fail(fut.error)
|
||||
else:
|
||||
retFuture.complete(fut.read())
|
||||
when T is void:
|
||||
retFuture.complete()
|
||||
else:
|
||||
retFuture.complete(fut.read())
|
||||
else:
|
||||
retFuture.fail(newException(AsyncTimeoutError, ""))
|
||||
else:
|
||||
|
Loading…
x
Reference in New Issue
Block a user