in reply to Re^2: Interactive IO with IO::Pipe on Win32
in thread Interactive IO with IO::Pipe on Win32
forwarding output from the command to the console.
By "forwarding" I assume you mean printing the input you receive?
The prompt will appear on the console, but only after the input has been entered.
That because you can't print it until you have read it, and you won't be able to read it until readline (in the guise of the diamond operator <$fh>), returns, which it won't until it see a newline.
As many prompts are printed without a newline so that the users input goes on the same line as the prompt, the text of the prompt will not be dispatched into the pipe until a newline is seen, and that won't happen until the user enters one.
Given that you appear to be printing everything received from the command, the tee trick I offered would probably work well for you. You just allow tee to do the forwarding and you just gather the output within your program for whatever processing you need to do, rather than echoing it yourself. The only extra step required is to filter the prompt and user input from the datastream.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Interactive IO with IO::Pipe on Win32
by Anonymous Monk on Feb 15, 2006 at 01:34 UTC | |
by BrowserUk (Patriarch) on Feb 15, 2006 at 02:13 UTC |