On Mon, Jul 11, 2016 at 12:53 PM, Tomáš Golembiovský <tgolembi@redhat.com> wrote:
On Wed, 6 Jul 2016 18:37:54 +0300
Yaniv Bronheim <ybronhei@redhat.com> wrote:

> On Wed, Jul 6, 2016 at 5:07 PM, Tomáš Golembiovský <tgolembi@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.


In vdsm we currently use cpopen to start external process - as multiprocess.popen in py2 is buggy. using execCmd doesn't provide stderr and stdout parameters to modify. but you can use CPopen directly and override stderr.
Over py3 we import the standard multiprocess.Popen. basically if its actually useful you can add those parameters to execCmd 




> > > [...]
> > >
> > > 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?

probably I didn't get you right at first. forget about watchcmd. I thought that you're trying to log the output and in watchcmd we do it with  execCmdLogger, so I wrote that to show you a reference .
 
--
Tomáš Golembiovský <tgolembi@redhat.com>
_______________________________________________
Devel mailing list
Devel@ovirt.org
http://lists.ovirt.org/mailman/listinfo/devel



--
Yaniv Bronhaim.