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

Write to pipe #86

Open
Pecka95 opened this issue Aug 23, 2022 · 0 comments
Open

Write to pipe #86

Pecka95 opened this issue Aug 23, 2022 · 0 comments

Comments

@Pecka95
Copy link

Pecka95 commented Aug 23, 2022

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;
}
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

1 participant