Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Re: Piping STDOUT to 'more'

by ariels (Curate)
on Mar 21, 2002 at 10:20 UTC ( #153287=note: print w/replies, xml ) Need Help??


in reply to Re: Piping STDOUT to 'more'
in thread Piping STDOUT to 'more'

The manpage for close says:
Closing a pipe also waits for the process executing on the pipe to complete.
This explains what's going on. If you don't close STDOUT, your process exits immediately when it finishes putting data into the queue. If you do, Perl waits for the more process to terminate (so it can provide an exit status).

If you add a wait after the loop (instead of close STDOUT), the more process runs "correctly". But if you page your way all the way through the file, you deadlock on Perl waiting for more to terminate, and more waiting for more data or end of file to terminate. (Typing <samp>q</samp> to exit more exits both programs, of course).

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2022-08-16 07:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?