EverNewJoy / VictoryPlugin

Rama's Victory BP Plugin
MIT License
867 stars 256 forks source link

Write to pipe #86

Open Pecka95 opened 2 years ago

Pecka95 commented 2 years ago

Hey! Thank you for your plugin! I have a question about writing to pipe and getting output from programm. I read the data from the "readPipe" without any problems. But when I try to send data something through "writePipe", I get the same in the response in "readPipe" instead of the real output from the programm.

image

I created a new function "WriteToPipe" using the example of other code

bool UExecutableProcessPipe::CreatePipe()
{
    if(PipeIsValid())
    {
        //Ignore repeat creates without a close inbetween <3 Rama
        return true;
    }
    return FPlatformProcess::CreatePipe( ReadPipe, WritePipe);
}
void UExecutableProcessPipe::ClosePipe()
{
    if(PipeIsValid())
    {
        FPlatformProcess::ClosePipe(ReadPipe, WritePipe);
        ReadPipe = nullptr;
        WritePipe = nullptr;
    }
}
bool UExecutableProcessPipe::ReadFromPipe(FString& PipeContents)
{
    PipeContents = "";

    if(!PipeIsValid()) 
    {
        return false;
    }
    PipeContents = FPlatformProcess::ReadPipe(ReadPipe);

    return true;
}

bool UExecutableProcessPipe::WriteToPipe(FString InputString)
{
    if(PipeIsValid())
    {
        return FPlatformProcess::WritePipe(WritePipe, InputString);
    }
    return false;
}