[ovirt-devel] execCmd() and storing stdout and stderr in log file

Tomáš Golembiovský tgolembi at redhat.com
Mon Jul 11 09:53:49 UTC 2016


On Wed, 6 Jul 2016 18:37:54 +0300
Yaniv Bronheim <ybronhei at redhat.com> wrote:

> On Wed, Jul 6, 2016 at 5:07 PM, Tomáš Golembiovský <tgolembi at redhat.com>
> wrote:
> 
> >
> > Merging stdout and stderr to one can POpen do for us, I belive. Any
> > logging can indeed be done as a wrapper around execCmd.
>
> saving stdout and err to log while the process is running is useful only
> for your purpose currently. using asyncproc as you do now in v2v allows you
> to to run a process and monitor it.. can you use overriding of aysncProc
> wrapper for your needs instead of changing cpopen or execcmd code?

I am not talking about CPOpen. I meant that when calling
`subprocess.Popen`, you can pass it `stderr=subprocess.STDOUT` argument
and it will handle the FD redirection (stream merging). To me it seems
like a proper way of doing this.


> > > [...]
> > >
> > > btw, after examine the area again, isn't watchCmd func is what you
> > >  describe? we just need to replace the asyncProc usages there with
> > > something that doesn't use StringIO as we do to support py3
> >
> > I'm not sure how watchCmd can help with this. Isn't it just a wrapper to
> > get asynchrounous process with a stop condition?
> >
> 
> it is. thought you need something similar and afterwards log the outputs

I can run async process with `execCmd` directly and I don't need any
stop condition. Am I missing something that `watchCmd` provides?

-- 
Tomáš Golembiovský <tgolembi at redhat.com>



More information about the Devel mailing list