Search code examples
perlstdoutpoe

How do I find the current value of a processes STDOUT in Perl?


I have a POE Perl program forking children.

The children it is forking do logging and interactive telnets into remote devices. POE uses STDOUT to return output back up to the parent process but for some reason it's getting lost (not going to screen or to any files).

I'm theorising that this is because STDOUT is being redirected somewhere - I need to ascertain where.

I have used (-t STDOUT) to identify that the STDOUT of the child is not a TTY.

I have also reset the STDOUT of the child to be that of the parent before the child was called - but this method seems to avoid POE's event handlers and it just dumps the output to parents STDOUT.

Q) How do I identify what the current STDOUT points at so I can find where my data is going

Thanks

Simon


Solution

  • This was down to the POE::Filter::Reference StdOut Handler being sent output by the child process that was not in the format it was expecting.

    Removed the filter - could then see what it was being sent and this enabled me to rectify the issue.

    The issue was the child process was spewing the contents of its subprocesses STDOUT back along the socket connection to the StdOut Handler.

    Simon