@contextlib.contextmanager<EOL>def less_display():
<EOL>_, filename = tempfile.mkstemp()<EOL>mode = stat.S_IRUSR | stat.S_IWUSR<EOL>outfile = None<EOL>outfile = os.fdopen(os.open(filename, os.O_WRONLY | os.O_CREAT, mode), "<STR_LIT:wb>")<EOL>try:<EOL><INDENT>yield SmartBuffer(outfile)<EOL>outfile.flush()<EOL>subprocess.call(["<STR_LIT>", "<STR_LIT>", filename])<EOL><DEDENT>finally:<EOL><INDENT>if outfile is not None:<EOL><INDENT>outfile.close()<EOL><DEDENT>if os.path.exists(filename):<EOL><INDENT>os.unlink(filename)<EOL><DEDENT><DEDENT>
Use smoke and mirrors to acquire 'less' for pretty paging