tasyncfilewrite.nim 318 B

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