Code Monkey home page Code Monkey logo

Comments (4)

bobeff avatar bobeff commented on July 18, 2024

I have the same problem. On Windows the build fails with:

asyncpipe.nim(260, 16) Error: undeclared identifier: 'PCustomOverlapped'

The build is easy to fix by importing asyncpty in asyncpipe.nim, but then the following simple example crashes.

import strformat, std/enumerate, os, asyncdispatch, asynctools/asyncproc

type
  ProcessOutput = tuple[exitCode: int, output: string]

var urlsToDownload: seq[string] = @[
  "www.w3.org/TR/html401/html40.txt",
  "www.w3.org/TR/2002/REC-xhtml1-20020801/xhtml1.pdf",
  "www.w3.org/TR/REC-html32.html",
  "www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/DOM2-Core.txt"]

proc downloadUrl(url: string): Future[ProcessOutput] {.async.} =
  return await asyncproc.execProcess(&"curl {url}")

var urlsContents: seq[Future[ProcessOutput]]
for url in urlsToDownload:
  echo &"Downloading {url} ..."
  urlsContents.add downloadUrl(url)

let results = waitFor all(urlsContents)
for i, result in enumerate(results):
  if result.exitCode != QuitSuccess:
    echo &"Error {result.exitCode}: {result.output}"
    continue
  let fileName = urlsToDownload[i].splitPath.tail
  writeFile(fileName, result.output)

I want to use the library for asynchronous processes in Nimble and this bug is blocking me.

from asynctools.

bobeff avatar bobeff commented on July 18, 2024

I found that the error happens only when there are more than one asynchronous processes. Then the program enters in the following branch.

from asynctools.

bung87 avatar bung87 commented on July 18, 2024

you still get error after this ?84ced6d

from asynctools.

bobeff avatar bobeff commented on July 18, 2024

you still get error after this ?84ced6d

Yes, the example above still raises an exception on Windows.

from asynctools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.