tasyncfilewrite.nim 333 B

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