diff options
author | Thomas Kluyver <takowl@gmail.com> | 2015-10-03 12:55:41 +0100 |
---|---|---|
committer | Thomas Kluyver <takowl@gmail.com> | 2015-10-03 12:55:41 +0100 |
commit | 823ad5164891ba148cc6857dc1400dedd1e78693 (patch) | |
tree | 7fe16736bce26749d4f3641e16d45f904e39e8c6 /pexpect/popen_spawn.py | |
parent | 6d68b93dd1e7e548bc51bee0edf6584efd5d833a (diff) | |
download | pexpect-git-823ad5164891ba148cc6857dc1400dedd1e78693.tar.gz |
Update docs for PopenSpawn and Windows support
Diffstat (limited to 'pexpect/popen_spawn.py')
-rw-r--r-- | pexpect/popen_spawn.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/pexpect/popen_spawn.py b/pexpect/popen_spawn.py index ab51499..680dd8a 100644 --- a/pexpect/popen_spawn.py +++ b/pexpect/popen_spawn.py @@ -1,4 +1,4 @@ -"""Spawn interface using subprocess.Popen +"""Provides an interface like pexpect.spawn interface using subprocess.Popen """ import os import threading @@ -121,6 +121,10 @@ class PopenSpawn(SpawnBase): self.send(s) def send(self, s): + '''Send data to the subprocess' stdin. + + Returns the number of bytes written. + ''' s = self._coerce_send_string(s) self._log(s, 'send') @@ -141,6 +145,10 @@ class PopenSpawn(SpawnBase): return n + self.send(self.linesep) def wait(self): + '''Wait for the subprocess to finish. + + Returns the exit code. + ''' status = self.proc.wait() if status >= 0: self.exitstatus = status @@ -152,6 +160,10 @@ class PopenSpawn(SpawnBase): return status def kill(self, sig): + '''Sends a Unix signal to the subprocess. + + Use constants from the :mod:`signal` module to specify which signal. + ''' if sys.platform == 'win32': if sig in [signal.SIGINT, signal.CTRL_C_EVENT]: sig = signal.CTRL_C_EVENT @@ -163,4 +175,5 @@ class PopenSpawn(SpawnBase): os.kill(self.proc.pid, sig) def sendeof(self): + '''Closes the stdin pipe from the writing end.''' self.proc.stdin.close() |