Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: nonblocking char reads from OUTPUT stream from open3

by dakkar (Hermit)
on Dec 14, 2002 at 21:35 UTC ( #219894=note: print w/replies, xml ) Need Help??

in reply to nonblocking char reads from OUTPUT stream from open3

ReadKey supposes that the filehandle refers to a terminal (TTY), not to a pipe (which is what Open3 gives you).

The error you reported means (more or less): what you gave me is not a terminal, can't do anything with it.

Try setting autoflush(1) on the filehandle.

        dakkar - Mobilis in mobile

Replies are listed 'Best First'.
Re: Re: nonblocking char reads from OUTPUT stream from open3
by Eradicatore (Monk) on Dec 14, 2002 at 23:07 UTC
    Thanks for the reply. I think I already set this. You say autoflush on the filehandle, but I'm not sure that is exactly what you meant. I don't think you can set autoflush on a specific filehandle can you? I just set $| to 1.

    Anyway, this still wasn't solving the problem. I started out actually with getc(), because I figured that with autoflush on, there would be no way I wouldn't get all the chars up to the point where this seperate process typed out the line (without a carriage return) with the wait for a "y" or "n". But for some reason, just on that one line, the getc() stopped working it seemed.


      You can set autoflush on a single handle:

      use IO::Handle; autoflush FH 1; # first way FH->autoflush(1); # OO-ish way

      But anyway, that's not what you need (I just tried). I just don't know how to do it... sorry

              dakkar - Mobilis in mobile

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://219894]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2022-05-24 19:35 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (84 votes). Check out past polls.