FPlatformProcess::CreateProc Is Terminated Instead of Waiting for Input

I am using FPlatformProcess::CreateProc to launch an external process, which is a console program. I can use the read pipe to see the process starts, and get the 10 line or so program status which it prints at launch.

The process is then terminated. It does this at the point where if it was ran outside of UE4 there would be a prompt waiting for input. All I am doing is polling the readPipe, nothing else is necessary to have the process closed by UE4.

My goal is to be able to read from and write to this console program. It was my understanding pipes are the best/easiest way to do this, but it seems like they may be broken? Hopefully I am missing a flag or something.

Anyone know anything about this? No progress made here.

Did you get any further with this? Want to open a program from within unreal and connect a pipe to it. Unreal sends to the secondary program.

for testing I made a little stdin reader

#include <fstream>
using namespace std;

int main()
    int helpercounter = 0;
    int something;
    ofstream myoutStream("finished.txt", ofstream::out);
    something = getchar();
        myoutStream << "NewInput " << something << endl;
        if(helpercounter%10 == 1)
            myoutStream << "StillRolling" << endl;
    }while((something = getchar()) != EOF);

    myoutStream << "LastChar " << something << endl;

    myoutStream << "We Are Done" << endl;

   return 0;

The finished.txt is created right after FPlatformProcess:CreateProc, means the created process shuts down right after creation.

I found out that when you jump over ** if (!::SetHandleInformation(ReadPipe, HANDLE_FLAG_INHERIT, 0)) **you can pass a ReadPipe to the process and the process stays alive.

bool FWindowsPlatformProcess::CreatePipe( void*& ReadPipe, void*& WritePipe )

    if (!::CreatePipe(&ReadPipe, &WritePipe, &Attr, 0))
        return false;

    if (!::SetHandleInformation(ReadPipe, HANDLE_FLAG_INHERIT, 0)) // JUMP OVER THIS
        return false;

    return true;

However, at somepoint a EOF is passed through and ruines everything. I don’t know where this EOF comes from. Just passing in color values, all >=0.

You need to pass param “bLaunchDetached” as false to FPlatformProcess::CreateProc to make waiting for input work