diff --git a/faststreams/outputs.nim b/faststreams/outputs.nim index 47bd990..efa508e 100644 --- a/faststreams/outputs.nim +++ b/faststreams/outputs.nim @@ -273,6 +273,14 @@ let fileOutputVTable = OutputStreamVTable( {.nimcall, gcsafe, raises: [IOError, Defect].} = 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) {.nimcall, gcsafe, raises: [IOError, Defect].} = close FileOutputStream(s).file diff --git a/faststreams/pipelines.nim b/faststreams/pipelines.nim index 82b3bd5..aa72f6e 100644 --- a/faststreams/pipelines.nim +++ b/faststreams/pipelines.nim @@ -127,7 +127,7 @@ when fsAsyncSupport: flush destination , flushAsync: proc (s: OutputStream): Future[void] - {.nimcall, gcsafe, raises: [IOError, Defect].} = + {.nimcall, gcsafe, raises: [IOError, Defect].} = fsTranslateErrors "Unexpected error from the async macro": let destination = LayeredOutputStream(s).destination if destination != nil: