Example #1
0
def page():
    """Capture output to stdout/stderr, and send it through ttypager when done"""
    out = StringIO()
    with redirect._redirect_stdout(out):
        with redirect._redirect_stderr(out):
            try:
                yield
            except:
                import traceback
                traceback.print_exc()
    ttypager_wrap(out.getvalue(), indent=False)
Example #2
0
def page():
    """Capture output to stdout/stderr, and send it through ttypager when done"""
    out = StringIO()
    with redirect._redirect_stdout(out):
        with redirect._redirect_stderr(out):
            try:
                yield
                output = out.getvalue()
            except:
                import traceback
                output = (traceback.format_exc()
                         + "\nOutput produced before exception:\n\n"
                         + out.getvalue())
    ttypager_wrap(output, indent=False)
Example #3
0
def page():
    """Capture output to stdout/stderr, and send it through ttypager when done"""
    out = ProgressStringIO()
    with redirect._redirect_stdout(out):
        with redirect._redirect_stderr(out):
            try:
                yield
                output = out.getvalue()
            except:
                import traceback
                output = (traceback.format_exc()
                         + "\nOutput produced before exception:\n\n"
                         + out.getvalue())
    ttypager_wrap(output, indent=False)