[Libguestfs] [PATCH] Don't display a progress bar if stderr isn't on a tty

Richard W.M. Jones rjones at redhat.com
Thu Jan 20 17:58:57 UTC 2011


On Thu, Jan 20, 2011 at 05:22:28PM +0000, Matthew Booth wrote:
> Apart from being a good idea, this works round an apparent bug in either
> Term::ProgressBar or Term::ReadKey which seems to result in an attempt to write
> an exceptionally long progress bar.
> 
> Fixes RHBZ#671083

ACK.

I'm a bit surprised that the progress bar is sent to STDERR by default
(the default in Term::ProgressBar).

For reference, similar code is used in guestfish except we check if
stdin is a tty not stderr, and we output to stdout:

http://git.annexia.org/?p=libguestfs.git;a=blob;f=fish/fish.c;h=10f645f5ddea81954b361d2ece62c20f2fd8eea1;hb=HEAD#l490
http://git.annexia.org/?p=libguestfs.git;a=blob;f=fish/progress.c;hb=HEAD

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org




More information about the Libguestfs mailing list