T
Thomas Secret
Following interesting problem:
1. I have created two pipe end points via IO.pipe:
stdin_read,stdin_write=IO.pipe
2. I have forked of a child, and redirected stdin of the child with:
$stdin.reopen(stdin_read)
3. In the parent process, I have used the other end of the pipe to write
to the stdin of the child:
stdin_write.puts "word1"
At that point, I am finished sending stuff through the pipe
automatically.
However, I am unsure whether my child may need any further input.
Because of that, I want to redirect the pipe end 'stdin_write' in the
parent to stdin, so that stuff coming in through stdin gets send on
through stdin_write (thus ending up in the stdin of the child).
Question: How do I do that?
The obvious first try of stdin_write.reopen($stdin) does not work, as it
destroys the pipe connection.
Of course I could just keep polling $stdin, and send anything I get on
to stdin_write, but really, ughh...
Does anybody have a nicer solution or idea?
1. I have created two pipe end points via IO.pipe:
stdin_read,stdin_write=IO.pipe
2. I have forked of a child, and redirected stdin of the child with:
$stdin.reopen(stdin_read)
3. In the parent process, I have used the other end of the pipe to write
to the stdin of the child:
stdin_write.puts "word1"
At that point, I am finished sending stuff through the pipe
automatically.
However, I am unsure whether my child may need any further input.
Because of that, I want to redirect the pipe end 'stdin_write' in the
parent to stdin, so that stuff coming in through stdin gets send on
through stdin_write (thus ending up in the stdin of the child).
Question: How do I do that?
The obvious first try of stdin_write.reopen($stdin) does not work, as it
destroys the pipe connection.
Of course I could just keep polling $stdin, and send anything I get on
to stdin_write, but really, ughh...
Does anybody have a nicer solution or idea?