I want outputs (both STDOUT and STDERR) and any output from system() of each of these "processes" to be captured in separate files preferably with STDOUT and STDERR outputs arranged properly.
What do you mean by:
"any output from system()"?
system doesn't produce output.
Programs run using system produce output; but you've already said you want to capture that.
So what other output ("produced by system()") are you expecting?
"with STDOUT and STDERR outputs arranged properly"?
stdout is usually buffered; whereas stderr is usually unbuffered; which means that stuff written to stderr often appears on the console before stuff that was written to stdout chronologically earlier in the execution of the program.
There is nothing that can be done from outside of the program to influence the that.
If you have access to the sources of the external programs you are running; you can ensure that both streams are unbuffered; but that has nothing to do with threading, or the perl code that is invoking those programs.
I think I can suggest something to achieve your goals; but I need you to answer those two questions first.
| [reply] |
Thanks for the reply again.
1. Sorry I was imprecise. I've meant that I want to capture output of the program that is being run by system call: STDOUT and STDERR, as well as STDOUT and STDERR produced by perl code in that "process".
2. You are correct is saying I can't control external program buffering from my perl script. I just want to see in my log file the same thing that I would see on the screen if I were to run that program independently from the command line.
| [reply] |
| [reply] |