Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

capturing stdout in real time

by dhofmeister (Initiate)
on Aug 20, 2012 at 18:49 UTC ( [id://988491]=perlquestion: print w/replies, xml ) Need Help??

dhofmeister has asked for the wisdom of the Perl Monks concerning the following question:

(ah, another stdout question!) i'm using perl 5.10 and IPC::Run3 (but it's not necessarily a requirement). i'm writting a perl program that (of course) calls "other programs". all is working reasonably well *except* for getting the stdout of the "other programs" -- in a timely manner. what i get is all the stdout at once when the "other program" ends. i'd rather get the stdout as it occurs. when i call run3, i am saying "run3 ....\&print_stdout" (which is a simple subroutine). is there a(n easy) way around this?

Replies are listed 'Best First'.
Re: capturing stdout in real time
by Illuminatus (Curate) on Aug 20, 2012 at 22:40 UTC
    stdout is normally buffered. Unless you can change the "other programs", or they have a runtime option to change the buffering, you don't have much choice. About the only thing you could do (and this would be messy), would be to get the program to write to a pty -- then it would be line-buffered, which would probably give you the data more quickly

    fnord

Re: capturing stdout in real time
by zentara (Archbishop) on Aug 21, 2012 at 09:27 UTC

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2024-04-26 04:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found