mercurial/profiling.py
changeset 36683 e39953fdd924
parent 36400 7b86aa31b004
child 38260 15a1e37f80bd
--- a/mercurial/profiling.py	Sat Mar 03 19:02:50 2018 -0500
+++ b/mercurial/profiling.py	Sat Mar 03 00:35:59 2018 -0500
@@ -14,6 +14,7 @@
     encoding,
     error,
     extensions,
+    pycompat,
     util,
 )
 
@@ -200,6 +201,17 @@
             elif self._output:
                 path = self._ui.expandpath(self._output)
                 self._fp = open(path, 'wb')
+            elif pycompat.iswindows:
+                # parse escape sequence by win32print()
+                class uifp(object):
+                    def __init__(self, ui):
+                        self._ui = ui
+                    def write(self, data):
+                        self._ui.write_err(data)
+                    def flush(self):
+                        self._ui.flush()
+                self._fpdoclose = False
+                self._fp = uifp(self._ui)
             else:
                 self._fpdoclose = False
                 self._fp = self._ui.ferr