Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Unified Diff: third_party/pexpect/tests/platform_checks/check_control_terminal.py

Issue 1398903002: Add third_party/pexpect (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@end-to-end-test
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/pexpect/tests/platform_checks/check_control_terminal.py
diff --git a/third_party/pexpect/tests/platform_checks/check_control_terminal.py b/third_party/pexpect/tests/platform_checks/check_control_terminal.py
new file mode 100644
index 0000000000000000000000000000000000000000..9598fd7ca6bc9fba0e82e0b2f72a7e987f6fc0ea
--- /dev/null
+++ b/third_party/pexpect/tests/platform_checks/check_control_terminal.py
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+
+import termios, fcntl, struct, os, sys
+
+def getwinsize():
+ s = struct.pack("HHHH", 0, 0, 0, 0)
+ x = fcntl.ioctl(sys.stdout.fileno(), termios.TIOCGWINSZ, s)
+ rows, cols = struct.unpack("HHHH", x)[:2]
+ return rows, cols
+
+def setwinsize(r,c):
+ # Assume ws_xpixel and ws_ypixel are zero.
+ s = struct.pack("HHHH", r,c,0,0)
+ x = fcntl.ioctl(sys.stdout.fileno(), termios.TIOCSWINSZ, s)
+print 'stdin tty:', os.ttyname(0)
+print 'stdout tty:', os.ttyname(1)
+print 'controlling terminal:', os.ctermid()
+print 'winsize %d,%d' % getwinsize()
+print 'ENDTEST'
« no previous file with comments | « third_party/pexpect/tests/platform_checks/check2.py ('k') | third_party/pexpect/tests/platform_checks/check_handler.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698