tasyncfilewrite.nim 332 B

1234567891011121314151617181920
  1. discard """
  2. output: '''string 1
  3. string 2
  4. string 3'''
  5. """
  6. # bug #5532
  7. import os, asyncfile, asyncdispatch
  8. const F = "test_async.txt"
  9. removeFile(F)
  10. let f = openAsync(F, fmWrite)
  11. var futs = newSeq[Future[void]]()
  12. for i in 1..3:
  13. futs.add(f.write("string " & $i & "\n"))
  14. waitFor(all(futs))
  15. f.close()
  16. echo readFile(F)
  17. removeFile(F)