Author: Armin Rigo <ar...@tunes.org>
Branch: stmgc-c8-gcc
Changeset: r79425:81299ae4c066
Date: 2015-09-04 15:54 +0200
http://bitbucket.org/pypy/pypy/changeset/81299ae4c066/

Log:    Use a pipe into "less" to scroll if the output is longer than one
        screen.

diff --git a/pypy/stm/print_stm_log.py b/pypy/stm/print_stm_log.py
--- a/pypy/stm/print_stm_log.py
+++ b/pypy/stm/print_stm_log.py
@@ -1,5 +1,5 @@
 #!/usr/bin/env pypy
-import sys
+import sys, os
 import struct, re, linecache
 
 # ____________________________________________________________
@@ -389,4 +389,9 @@
     return 0
 
 if __name__ == '__main__':
-    sys.exit(main(sys.argv[1:]))
+    if sys.stdout.isatty():
+        sys.stdout = os.popen("less --quit-if-one-screen", "w")
+    try:
+        sys.exit(main(sys.argv[1:]))
+    finally:
+        sys.stdout.close()
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to