-
Notifications
You must be signed in to change notification settings - Fork 92
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
I can send() but I have no way of closing the input channel #21
Comments
#include <subprocess.hpp>
using namespace std;
using namespace subprocess;
int main()
{
auto p = Popen({"cat", "-"}, input{PIPE}, output{"cat_fredirect.txt"});
auto msg = "through stdin to stdout";
p.send(msg, strlen(msg));
p.wait();
} i tried the code in the readme.md and it still waits forever. Haalp! |
I made for ( int i = 0 ; i < 5 ; i++ )
{
sub_processes.emplace_back(Popen({"cat", "-"},input{PIPE}));
sub_processes[i].send("3 5\n", 5);
sub_processes[i].stream_.input_.reset();
} |
You didn't have to make "stream_" public for this.
|
Hi @arun11299 |
Ah..ofcourse. I will provide an API to fix it. Thanks :) |
i am looking forward to that. have a nice day |
I have added this test.
Let me know if it works for you. And, Happy new year!! |
yeah it works greatly thanks for this beautiful project. |
In the code above I spawn 5 instances of cat. I call
send()
to each of them.In the second loop we call wait but it waits forever. I suspect that cat is still waiting for more input because the channel was not closed.
communicate()
does close the channels. But I need to use send() is there a function I am missing that can close the channels?Thanks in advance.
The text was updated successfully, but these errors were encountered: