Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The AsyncIPC example does not work on windows #12

Open
abijahm opened this issue Aug 10, 2018 · 2 comments
Open

The AsyncIPC example does not work on windows #12

abijahm opened this issue Aug 10, 2018 · 2 comments

Comments

@abijahm
Copy link

abijahm commented Aug 10, 2018

i get the following error when running the asyncipc example

example.nim(12)          example
asyncipc.nim(238)        open
oserr.nim(110)           raiseOSError
Error: unhandled exception: The parameter is incorrect.
 [OSError]
Error: execution of an external program failed: 'e:\inter-process\example.exe '

if i add
echo getLastError()

after this line it seems to work
https://github.com/cheatfate/asynctools/blob/master/asynctools/asyncipc.nim#L233

@cheatfate
Copy link
Owner

@abijahm could you please share your example.nim code?

@abijahm
Copy link
Author

abijahm commented Aug 11, 2018

import asyncdispatch

import asynctools/asyncipc

var inBuffer = newString(64)
var outBuffer = "TEST STRING BUFFER"

# create new IPC object
let ipc = createIpc("test")
# open `read` side channel to IPC object
let readHandle = open("test", sideReader)
# open `write` side channel to IPC object
let writeHandle = open("test", sideWriter)

# writing string to IPC object
waitFor write(writeHandle, cast[pointer](addr outBuffer[0]), len(outBuffer))
# reading data from IPC object
var c = waitFor readInto(readHandle, cast[pointer](addr inBuffer[0]), 64)

inBuffer.setLen(c)
doAssert(inBuffer == outBuffer)

echo inBuffer
# Close `read` side channel
close(readHandle)
# Close `write` side channel
close(writeHandle)
# Close IPC object
close(ipc)

output

example.nim(12)          example
asyncipc.nim(237)        open
oserr.nim(110)           raiseOSError
Error: unhandled exception: The parameter is incorrect.
 [OSError]
Error: execution of an external program failed: 'e:\inter-process\example.exe '

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants