allowAsyncOps applies to async file flushing as well
This commit is contained in:
parent
e2e83fa27b
commit
02d120b7f6
2 changed files with 9 additions and 1 deletions
|
|
@ -273,6 +273,14 @@ let fileOutputVTable = OutputStreamVTable(
|
||||||
{.nimcall, gcsafe, raises: [IOError, Defect].} =
|
{.nimcall, gcsafe, raises: [IOError, Defect].} =
|
||||||
flushFile FileOutputStream(s).file
|
flushFile FileOutputStream(s).file
|
||||||
,
|
,
|
||||||
|
flushAsync: proc (s: OutputStream): Future[void]
|
||||||
|
{.nimcall, gcsafe, raises: [IOError, Defect].} =
|
||||||
|
fsAssert FileOutputStream(s).allowAsyncOps
|
||||||
|
flushFile FileOutputStream(s).file
|
||||||
|
result = newFuture[void]()
|
||||||
|
fsTranslateErrors "Unexpected exception from merely completing a future":
|
||||||
|
result.complete()
|
||||||
|
,
|
||||||
closeSync: proc (s: OutputStream)
|
closeSync: proc (s: OutputStream)
|
||||||
{.nimcall, gcsafe, raises: [IOError, Defect].} =
|
{.nimcall, gcsafe, raises: [IOError, Defect].} =
|
||||||
close FileOutputStream(s).file
|
close FileOutputStream(s).file
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@ when fsAsyncSupport:
|
||||||
flush destination
|
flush destination
|
||||||
,
|
,
|
||||||
flushAsync: proc (s: OutputStream): Future[void]
|
flushAsync: proc (s: OutputStream): Future[void]
|
||||||
{.nimcall, gcsafe, raises: [IOError, Defect].} =
|
{.nimcall, gcsafe, raises: [IOError, Defect].} =
|
||||||
fsTranslateErrors "Unexpected error from the async macro":
|
fsTranslateErrors "Unexpected error from the async macro":
|
||||||
let destination = LayeredOutputStream(s).destination
|
let destination = LayeredOutputStream(s).destination
|
||||||
if destination != nil:
|
if destination != nil:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue