diff options
author | Thomas Kluyver <takowl@gmail.com> | 2017-12-21 10:56:19 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-21 10:56:19 +0000 |
commit | 28e82cda5056df20ec55995ea7fe66abd346f6bb (patch) | |
tree | a230085363547a24c5e0903d71db6aaad8b6bb98 | |
parent | 8a1195a4837bd4f7477dff6f7c6a22c234e192e7 (diff) | |
parent | 543d320f615b2589d19e92ccf4c57719c27d0067 (diff) | |
download | pexpect-28e82cda5056df20ec55995ea7fe66abd346f6bb.tar.gz |
Merge pull request #460 from tcwalther/master
Add preexec_fn to PopenSpawn
-rw-r--r-- | pexpect/popen_spawn.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/pexpect/popen_spawn.py b/pexpect/popen_spawn.py index 0a1b226..e591197 100644 --- a/pexpect/popen_spawn.py +++ b/pexpect/popen_spawn.py @@ -24,15 +24,15 @@ class PopenSpawn(SpawnBase): crlf = '\n' def __init__(self, cmd, timeout=30, maxread=2000, searchwindowsize=None, - logfile=None, cwd=None, env=None, encoding=None, - codec_errors='strict'): + logfile=None, cwd=None, env=None, encoding=None, + codec_errors='strict', preexec_fn=None): super(PopenSpawn, self).__init__(timeout=timeout, maxread=maxread, searchwindowsize=searchwindowsize, logfile=logfile, encoding=encoding, codec_errors=codec_errors) kwargs = dict(bufsize=0, stdin=subprocess.PIPE, stderr=subprocess.STDOUT, stdout=subprocess.PIPE, - cwd=cwd, env=env) + cwd=cwd, preexec_fn=preexec_fn, env=env) if sys.platform == 'win32': startupinfo = subprocess.STARTUPINFO() @@ -124,7 +124,7 @@ class PopenSpawn(SpawnBase): def send(self, s): '''Send data to the subprocess' stdin. - + Returns the number of bytes written. ''' s = self._coerce_send_string(s) @@ -148,7 +148,7 @@ class PopenSpawn(SpawnBase): def wait(self): '''Wait for the subprocess to finish. - + Returns the exit code. ''' status = self.proc.wait() @@ -163,7 +163,7 @@ class PopenSpawn(SpawnBase): 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': |