How can i properly use FPlatformProcess::ReadPipe?

Hi, I’m trying to make a child process dynamically and give it a signal through pipe made in parent process.

I created pipe with FPlatformProcess::CreatePipe and put those values as parameters of FPlatformProcess::CreateProc.

child process successfully pops up but how can child read pipe from parent?

child doesn’t have any clue about address of pipe from parent but FPlatformProcess::ReadPipe requires the address of pipe.

2 Likes

this answer may be late,but here’s how it works:
define your own pipe read and write handle like this: void* readHandle;void* writeHandle;
use the CreatePipe function to create a pipe and set the handles:FPlatformProcess::CreatePipe(readHandle,writeHandle);
when creating the process, use the handles above as write child parameter, note that you don’t need to pass the read child parameter, since there’s no need for outer process to read(if there’s any need for this, just create another pipe and use the readHandle as the readPipeChild parameter)
when you want to read the pipe, just do:ReadPipe(readHandle);
note that readHandle is only used for reading operation, and writeHandle do the opposite.So this is a one way pipe.In your case, the data is transmitted from outer process to ue.
When wanting to pass data from ue to outer process, you may need to create another pipe
this topic may provide some relavant infomation: WritePipe does not work with exe process - Development / Programming & Scripting - Epic Developer Community Forums