Thread

Posted on Fri Dec 22 02:53:11 2006 by duaneellis
capture log stderr in addition to stdout from a subprocess
I'm using "expect.pm" - it works well, and I'm using this method:
$object->log_file( \&my_log_function );
I do not see a way to capture the spawn'ed processes STDERR. As an alternative, is there a way to map the sub-processes STDERR to STDOUT (much like one would do a BASH command line) My problem is the subprocess is generating both *stdout* and *stderr* the stdout, I can log, the stderr - I cannot get to (or do not know how).
I can manage the problem *IF* stdout and stderr are the same for the subprocess. I just do not know how to do this. Any suggestions?
Direct Responses: 4341 | Write a response
Posted on Wed Feb 14 12:34:16 2007 by rgiersig in response to 3876
Re: capture log stderr in addition to stdout from a subprocess
strange... the pty is set up to get both stdout and stderr from the spawned command, so the logging should write both to the logfile. you can of course spawn the command with "2>&1" attached, but i don't think thats the error. maybe the spawned application opens /dev/tty? this should also point to the pty but doesn't reliably do so on all systems...
Write a response