in reply to Re^3: Interactive IO with IO::Pipe on Win32
in thread Interactive IO with IO::Pipe on Win32

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.

I think you hit the nail on the head. For some reason I was thinking that I had the same problem with multi-line prompts (i.e. none of the prompt was visible until after user input). On the contrary, I just tested my script with a program that generates a five line prompt and the entire prompt was visible prior to input.

I guess I'll have to read from the pipe with sysread or something like it. Thanks for your help!

  • Comment on Re^4: Interactive IO with IO::Pipe on Win32

Replies are listed 'Best First'.
Re^5: Interactive IO with IO::Pipe on Win32
by BrowserUk (Patriarch) on Feb 15, 2006 at 02:13 UTC
    I guess I'll have to read from the pipe with sysread or something like it.

    If you succeed in getting that to work please come back and post a sample.

    I looked at the source of tee and it just uses (C) read() from stdin, and it seems to be able to read and echo the prompt in a timely fashion, but regardless of what I tried from perl (binmode :raw; read() or sysread()), I couldn't get it to work.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.