1827288 Members
3794 Online
109717 Solutions
New Discussion

Monitoring Stdout

 
Scott McDade
Frequent Advisor

Monitoring Stdout

I am trying to figure out a way to monitor stdout. I have several C and Perl apps running together on an 11i machine and I am getting some inconsistant behavior and I suspect it may be due to stdout sharing between the 2 progs.

Can anyone tell me how to monitor stdout?

-Scott
Keep it Simple!~
2 REPLIES 2
doug mielke
Respected Contributor

Re: Monitoring Stdout

does re direction to file not work when you call the scripts?
Ralph Grothe
Honored Contributor

Re: Monitoring Stdout

How are the processes communicating with one another?
Is one writing to stdout what the other is reading from its stdin?
What do your pipes look like?

Sometimes buffering is getting in the way and mangling the correct sequence of communication (a common issue in IPC).

I cannot tell what to do in C.
I
n Perl it is advisable to enforce autoflushing in your Perl code by defining the special variable "$|".

Usual Perl idioms to this end are:

$|++;
# or
$| = 1;

# or if you have to flush other file handles
select((select(HANDLE), $|++)[0]);


If you don't mind importing some other code you could also use the IO::Handle (or IO::File, actually inheriting from IO::Handle)module that offer an autoflush method that avoids the arcane select idiom above.
Madness, thy name is system administration