Chromium Code Reviews| Index: mojo/devtools/common/devtoolslib/utils.py |
| diff --git a/mojo/devtools/common/devtoolslib/utils.py b/mojo/devtools/common/devtoolslib/utils.py |
| index 7bf2e1c641221f2d89e25022c7301a10b5d8a4b8..085d2253cd3829ee4f8e22ad63b4645d1f9eb651 100644 |
| --- a/mojo/devtools/common/devtoolslib/utils.py |
| +++ b/mojo/devtools/common/devtoolslib/utils.py |
| @@ -4,6 +4,9 @@ |
| """Python utils.""" |
| +import os |
| +import sys |
| + |
| def overrides(parent_class): |
| """Inherits the docstring from the method of the same name in the indicated |
| @@ -14,3 +17,11 @@ def overrides(parent_class): |
| method.__doc__ = getattr(parent_class, method.__name__).__doc__ |
| return method |
| return overriding |
| + |
| + |
| +def disable_output_buffering(): |
| + """Disables the buffering of the stdout. Devtools command line scripts should |
| + do so, so that their stdout is consistent when not directly attached to a |
| + terminal (e.g. because another script runs devtools in a subprocess). |
| + """ |
| + sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0) |
|
qsr
2016/05/10 16:15:21
How portable is this? Does this work on every plat
ppi
2016/05/10 16:17:08
Good question - I will check that it works on Mac
ppi
2016/05/11 11:21:29
Mac seems to be happy w/ this.
|