[Solved] QProcess pipe creation on Windows
-
In porting from Qt4 to Qt5 I had problems with the named pipes. I found I had to make the following adjustments:
original:
@ hRead = CreateNamedPipe(pipeName,
PIPE_ACCESS_INBOUND | FILE_FLAG_OVERLAPPED,
dwPipeFlags,
1, // only one pipe instance
0, // output buffer size
dwPipeBufferSize, // input buffer size
0,
&secAtt);
hWrite = CreateFile(pipeName,
GENERIC_WRITE,
0,
&secAtt,
OPEN_EXISTING,
FILE_FLAG_OVERLAPPED,
NULL);
@
My version:@ hRead = CreateNamedPipe(pipeName,
( isInputPipe ? PIPE_ACCESS_OUTBOUND : PIPE_ACCESS_INBOUND ) | FILE_FLAG_OVERLAPPED,
dwPipeFlags,
1, // only one pipe instance
dwPipeBufferSize, // output buffer size
dwPipeBufferSize, // input buffer size
0,
&secAtt);
hWrite = CreateFile(pipeName,
isInputPipe ? GENERIC_READ | FILE_WRITE_ATTRIBUTES :
GENERIC_WRITE,
0,
&secAtt,
OPEN_EXISTING,
FILE_FLAG_OVERLAPPED,
NULL);
@Isn't it essential to have the in/out dependent mode settings???
-
Hi and welcome to devnet,
It seems indeed to be strange. You should check the "bug report system":http://bugreports.qt-project.org to see whether it's something known. If not, you could open a new bug report explaining what was working and what doesn't. Providing a minimal compilable example that shows the behavior would be really great.
-
Thanks.
I just filed a bug report.I couldn't find a report mentioning the same issue.
It's not simple to extract a minimal example, but I'll try. -
Can you share the link to the report ?
-
Sure:
https://bugreports.qt-project.org/browse/QTBUG-35357I realize it's terse. I'm working on an extracted sample. Problem is, this is a huge project. I'm having another issue that might be or not be related. And is in cooperation with libuv, which is complex in its own way.
-
Do you know how to trigger the bad behavior ?
Just a supposition but I think you need two processes: one that you call with QProcess and your software where you use QProcess then you can establish the communication between the two. So it looks like a subdir project with two applications. Hope it helps
-
Yes, that's exactly what I'm working on. I've been able to set it up like that with 2 VS-2012 projects, which I can run/debug in parallel. I need to 'skin' libuv to get something communicable.
-
Great ! If I may, once you're done, convert them in one or two qmake powered project so it's not tied to VS
-
Just saw that the bug has been solved, please update the thread title prepending [solved] so other forum users may know that a solutions has been found :)