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

Side by Side Diff: third_party/pexpect/tools/display-fpathconf.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 unified diff | Download patch
« no previous file with comments | « third_party/pexpect/tests/utils.py ('k') | third_party/pexpect/tools/display-maxcanon.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 """Displays os.fpathconf values related to terminals. """
3 from __future__ import print_function
4 import sys
5 import os
6
7
8 def display_fpathconf():
9 DISP_VALUES = (
10 ('PC_MAX_CANON', ('Max no. of bytes in a '
11 'terminal canonical input line.')),
12 ('PC_MAX_INPUT', ('Max no. of bytes for which '
13 'space is available in a terminal input queue.')),
14 ('PC_PIPE_BUF', ('Max no. of bytes which will '
15 'be written atomically to a pipe.')),
16 ('PC_VDISABLE', 'Terminal character disabling value.')
17 )
18 FMT = '{name:<13} {value:<5} {description}'
19
20 # column header
21 print(FMT.format(name='name', value='value', description='description'))
22 print(FMT.format(name=('-' * 13), value=('-' * 5), description=('-' * 11)))
23
24 fd = sys.stdin.fileno()
25 for name, description in DISP_VALUES:
26 key = os.pathconf_names.get(name, None)
27 if key is None:
28 value = 'UNDEF'
29 else:
30 try:
31 value = os.fpathconf(fd, name)
32 except OSError as err:
33 value = 'OSErrno {0.errno}'.format(err)
34 if name == 'PC_VDISABLE':
35 value = hex(value)
36 print(FMT.format(name=name, value=value, description=description))
37 print()
38
39
40 if __name__ == '__main__':
41 display_fpathconf()
OLDNEW
« no previous file with comments | « third_party/pexpect/tests/utils.py ('k') | third_party/pexpect/tools/display-maxcanon.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698