progress vs. redirected output (was: Re: [PATCH] progress: document progress.disable config option)

Thomas Arendsen Hein thomas at intevation.de
Fri Mar 12 10:06:40 CST 2010


* Augie Fackler <lists at durin42.com> [20100312 16:56]:
> On Fri, Mar 12, 2010 at 9:52 AM, Thomas Arendsen Hein
> <thomas at intevation.de> wrote:
> > * Steve Borho <steve at borho.org> [20100312 04:05]:
> >> On Thu, Mar 11, 2010 at 6:09 PM, TK Soh <teekaysoh at gmail.com> wrote:
> >> > Just feel little strange on the need of 'disable'. Why enable the
> >> > extension (via extensions section) and disable it (in progress
> >> > section) later? Any use case?
> >>
> >> It causes garbage to be displayed in the tortoisehg command windows.
> >> This could probably be fixed properly, but the problem was found right
> >> before 1.5 was released, and needed a workaround.
> >
> > Hrm, all previous implementations of progress bars disabled
> > themselves when output was redirected by checking fd.isatty()
> 
> Mine does that. Tortoise evidently pretends really really hard that
> it's a real console, and confuses ui.interactive().

My ui.interactive() seems to be different from yours :)

Mine just checks sys.stdin.isatty(), not stdout or stderr.

With "hg clone ... </dev/null" it gets disabled, but not with
"hg clone ... |cat" or "hg clone ... 2>&1 |cat".

> > Additionally sending the progress bar to sys.stderr would be good so
> > you still have a progress bar when redirecting only stdout.
> 
> That seems reasonable. If nobody objects to that change, I'll send it
> this afternoon.

Be careful to check sys.stderr.isatty() after that change :)

Thomas

-- 
thomas at intevation.de - http://intevation.de/~thomas/ - OpenPGP key: 0x5816791A
Intevation GmbH, Neuer Graben 17, 49074 Osnabrueck - AG Osnabrueck, HR B 18998
Geschaeftsfuehrer: Frank Koormann, Bernhard Reiter, Dr. Jan-Oliver Wagner


More information about the Mercurial-devel mailing list