[PATCH] ui: flush stderr after printing a non-chained exception for Windows

Yuya Nishihara yuya at tcha.org
Sat Jun 13 04:22:25 UTC 2015


On Fri, 12 Jun 2015 23:53:33 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1434161381 14400
> #      Fri Jun 12 22:09:41 2015 -0400
> # Node ID a9a90e8afc80f372d62f7f6eacc163bc8f48cce9
> # Parent  e8075329c5fbb651508777c15cb6bc9ae33b5dff
> ui: flush stderr after printing a non-chained exception for Windows

> diff --git a/mercurial/ui.py b/mercurial/ui.py
> --- a/mercurial/ui.py
> +++ b/mercurial/ui.py
> @@ -6,7 +6,7 @@
>  # GNU General Public License version 2 or any later version.
>  
>  from i18n import _
> -import errno, getpass, os, socket, sys, tempfile, traceback
> +import cStringIO, errno, getpass, os, socket, sys, tempfile, traceback
>  import config, scmutil, util, error, formatter, progress
>  from node import hex
>  
> @@ -869,9 +869,10 @@
>                                 ''.join(causetb),
>                                 ''.join(exconly))
>              else:
> -                self.flush()  # flush debug or status message
> +                output = cStringIO.StringIO()
>                  traceback.print_exception(exc[0], exc[1], exc[2],
> -                                          file=self.ferr)
> +                                          file=output)
> +                self.write_err(output.getvalue())

Gah, my bad. We can use traceback.format_exception() to get list of output
strings.



More information about the Mercurial-devel mailing list