[prev in list] [next in list] [prev in thread] [next in thread] 

List:       klik-devel
Subject:    Re: [klik-devel] Tee command in python for capturing stderr
From:       Jeff Licquia <jeff () licquia ! org>
Date:       2007-11-13 22:35:40
Message-ID: 473A26BC.6080309 () licquia ! org
[Download RAW message or body]

Jason Taylor wrote:
>> error_log = open(error_log_path, "w")
>> app = Popen(["myprog"], stderr = PIPE)
>> for line in app.stderr:
>>      sys.stderr.write(line)
>>      error_log.write(line)
> 
> If the subprocess starts a daemon process ... and we dont want to exit
> until the daemon finishes will this work?
> 
> At the moment I check the pids using the fuse mount (using fuser) to
> determine if all processes are complete.
> 
> I've found that wait will only test the direct process not any children
> 
> Im guessing the same will apply for stderr, we will only get the child
> not the grandchildren ?'
That's most likely true; daemons typically disassociate themselves from 
the process group and close file descriptors.  So you'll probably still 
have to do the fuse thing.

The stderr output from all children, grandchildren, etc. should be 
captured by this method up until someone plays with stderr, as daemons 
will often do.  But this isn't unique to this method; the tee method 
should have the same problem.

_______________________________________________
klik-devel mailing list
klik-devel@kde.org
https://mail.kde.org/mailman/listinfo/klik-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic