for this part of code is given down and it is working fine. This just gives the idea of how output of different process is handled in temprary files.
A number of subprocessed (more than three at least) are forked and these subprocess logs their output in temporary files. as a processes completes its execution its output from its temporary file is displayed on the consol.
the code for output handling is given below (It does not include the code for forking process, autofleshing, reading from childs IO::Select and other stuff.) it works fine.
my question is:
can i display the output of one process in real time instead of loging it in temporary file and the output of other the remaining processes should be loged in temporary files simultaneosuly.
The peice of code
------------------
sub Pooled_function {
my($id,$parentfh) = @_;
print $parentfh "start\n";
close(STDOUT);
close(STDERR);
while (1) {
chomp(my $pclass = <$parentfh>);
my $file = "$build_logs_dir/$pclass.log";
open(STDOUT, "> $file") or die "Can't redirect stdout: to $file "
+;
open(STDERR, ">&STDOUT");
# ----------- Do the stuff ------
close(STDOUT) or die "Can't close STDOUT: $!";
close(STDERR) or die "Can't close STDERR: $!";
print $parentfh "$id $pclass $result\n";
}
close($parentfh);
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.