[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: [PATCH] Do not use communicate() when we redirect to file desc, it changes line buffering to block buffering which makes interactive scripts in kickstart impossible to use (#506664)
- From: Martin Sivak <msivak redhat com>
- To: Discussion of Development and Customization of the Red Hat Linux Installer <anaconda-devel-list redhat com>
- Subject: Re: [PATCH] Do not use communicate() when we redirect to file desc, it changes line buffering to block buffering which makes interactive scripts in kickstart impossible to use (#506664)
- Date: Tue, 30 Jun 2009 10:55:29 -0400 (EDT)
True.. I'm wondering if you can switch Popen to use line buffered mode instead.. (checking now)
----- "Chris Lumens" <clumens redhat com> wrote:
> > diff --git a/iutil.py b/iutil.py
> > index ba1d0b4..1e90025 100644
> > --- a/iutil.py
> > +++ b/iutil.py
> > @@ -87,23 +87,13 @@ def execWithRedirect(command, argv, stdin =
> None, stdout = None,
> >
> > try:
> > proc = subprocess.Popen([command] + argv, stdin=stdin,
> > - stdout=subprocess.PIPE,
> > - stderr=subprocess.PIPE,
> > + stdout=stdout,
> > + stderr=stderr,
> > preexec_fn=chroot, cwd=root,
> > env=env)
> > + proc.wait()
> > + ret = proc.returncode
> >
> > - while True:
> > - (outStr, errStr) = proc.communicate()
> > - if outStr:
> > - os.write(stdout, outStr)
> > - runningLog.write(outStr)
> > - if errStr:
> > - os.write(stderr, errStr)
> > - runningLog.write(errStr)
> > -
> > - if proc.returncode is not None:
> > - ret = proc.returncode
> > - break
> > except OSError as e:
> > errstr = "Error running %s: %s" % (command, e.strerror)
> > log.error(errstr)
>
> This means that anything run through execWithRedirect will not get
> written to /tmp/program.log, though.
>
> - Chris
>
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list redhat com
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]