popen_spawn - use pexpect with a piped subprocess¶
Provides an interface like pexpect.spawn interface using subprocess.Popen
PopenSpawn class¶
- class pexpect.popen_spawn.PopenSpawn(cmd, timeout=30, maxread=2000, searchwindowsize=None, logfile=None, cwd=None, env=None, encoding=None, codec_errors='strict', preexec_fn=None)[source]¶
- __init__(cmd, timeout=30, maxread=2000, searchwindowsize=None, logfile=None, cwd=None, env=None, encoding=None, codec_errors='strict', preexec_fn=None)[source]¶
- sendline(s='')[source]¶
Wraps send(), sending string
s
to child process, with os.linesep automatically appended. Returns number of bytes written.
- writelines(sequence)[source]¶
This calls write() for each element in the sequence.
The sequence can be any iterable object producing strings, typically a list of strings. This does not add line separators. There is no return value.
- kill(sig)[source]¶
Sends a Unix signal to the subprocess.
Use constants from the
signal
module to specify which signal.
- expect()¶
- expect_exact()¶
- expect_list()¶
As
pexpect.spawn
.