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 Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



True.. I'm wondering if you can switch Popen to use line buffered mode instead.. (checking now)

----- "Chris Lumens" <clumens@xxxxxxxxxx> 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@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux