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

Side by Side Diff: third_party/pexpect/doc/api/pexpect.rst

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/doc/api/index.rst ('k') | third_party/pexpect/doc/api/popen_spawn.rst » ('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 Core pexpect components
2 =======================
3
4 .. automodule:: pexpect
5
6 spawn class
7 -----------
8
9 .. autoclass:: spawn
10
11 .. automethod:: __init__
12 .. automethod:: expect
13 .. automethod:: expect_exact
14 .. automethod:: expect_list
15 .. automethod:: compile_pattern_list
16 .. automethod:: send
17 .. automethod:: sendline
18 .. automethod:: write
19 .. automethod:: writelines
20 .. automethod:: sendcontrol
21 .. automethod:: sendeof
22 .. automethod:: sendintr
23 .. automethod:: read
24 .. automethod:: readline
25 .. automethod:: read_nonblocking
26 .. automethod:: eof
27 .. automethod:: interact
28
29 .. attribute:: logfile
30 logfile_read
31 logfile_send
32
33 Set these to a Python file object (or :data:`sys.stdout`) to log all
34 communication, data read from the child process, or data sent to the child
35 process.
36
37 .. note::
38
39 With :class:`spawn` in bytes mode, the log files should be open for
40 writing binary data. In unicode mode, they should
41 be open for writing unicode text. See :ref:`unicode`.
42
43 Controlling the child process
44 `````````````````````````````
45
46 .. class:: spawn
47
48 .. automethod:: kill
49 .. automethod:: terminate
50 .. automethod:: isalive
51 .. automethod:: wait
52 .. automethod:: close
53 .. automethod:: getwinsize
54 .. automethod:: setwinsize
55 .. automethod:: getecho
56 .. automethod:: setecho
57 .. automethod:: waitnoecho
58
59 .. attribute:: pid
60
61 The process ID of the child process.
62
63 .. attribute:: child_fd
64
65 The file descriptor used to communicate with the child process.
66
67 .. _unicode:
68
69 Handling unicode
70 ````````````````
71
72 By default, :class:`spawn` is a bytes interface: its read methods return bytes,
73 and its write/send and expect methods expect bytes. If you pass the *encoding*
74 parameter to the constructor, it will instead act as a unicode interface:
75 strings you send will be encoded using that encoding, and bytes received will
76 be decoded before returning them to you. In this mode, patterns for
77 :meth:`~spawn.expect` and :meth:`~spawn.expect_exact` should also be unicode.
78
79 .. versionchanged:: 4.0
80
81 :class:`spawn` provides both the bytes and unicode interfaces. In Pexpect
82 3.x, the unicode interface was provided by a separate ``spawnu`` class.
83
84 For backwards compatibility, some Unicode is allowed in bytes mode: the
85 send methods will encode arbitrary unicode as UTF-8 before sending it to the
86 child process, and its expect methods can accept ascii-only unicode strings.
87
88 .. note::
89
90 Unicode handling with pexpect works the same way on Python 2 and 3, despite
91 the difference in names. I.e.:
92
93 - Bytes mode works with ``str`` on Python 2, and :class:`bytes` on Python 3,
94 - Unicode mode works with ``unicode`` on Python 2, and :class:`str` on Python 3.
95
96 run function
97 ------------
98
99 .. autofunction:: run
100
101 Exceptions
102 ----------
103
104 .. autoclass:: EOF
105
106 .. autoclass:: TIMEOUT
107
108 .. autoclass:: ExceptionPexpect
109
110 Utility functions
111 -----------------
112
113 .. autofunction:: which
114
115 .. autofunction:: split_command_line
OLDNEW
« no previous file with comments | « third_party/pexpect/doc/api/index.rst ('k') | third_party/pexpect/doc/api/popen_spawn.rst » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698