diff options
author | Thomas Kluyver <takowl@gmail.com> | 2016-01-04 14:51:19 +0000 |
---|---|---|
committer | Thomas Kluyver <takowl@gmail.com> | 2016-01-04 14:51:19 +0000 |
commit | 4a2128a00d42dc0ce90cb7cac00d0b7278a23531 (patch) | |
tree | 5fb3e76b6b35803474b9f471840af4e3dbaf7636 | |
parent | 8af334bf38a79778d96eed63e99a0a5e4b2f6f80 (diff) | |
parent | ddd4bfd4258eb080c128713600aaee95fee66b85 (diff) | |
download | pexpect-4a2128a00d42dc0ce90cb7cac00d0b7278a23531.tar.gz |
Merge pull request #303 from jdemeyer/master
Allow overriding the call to PtyProcess.spawn()
-rw-r--r-- | pexpect/pty_spawn.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/pexpect/pty_spawn.py b/pexpect/pty_spawn.py index 5870f73..ccb38b3 100644 --- a/pexpect/pty_spawn.py +++ b/pexpect/pty_spawn.py @@ -290,8 +290,8 @@ class spawn(SpawnBase): self.args = [a if isinstance(a, bytes) else a.encode(self.encoding) for a in self.args] - self.ptyproc = ptyprocess.PtyProcess.spawn(self.args, env=self.env, - cwd=self.cwd, **kwargs) + self.ptyproc = self._spawnpty(self.args, env=self.env, + cwd=self.cwd, **kwargs) self.pid = self.ptyproc.pid self.child_fd = self.ptyproc.fd @@ -300,6 +300,10 @@ class spawn(SpawnBase): self.terminated = False self.closed = False + def _spawnpty(self, args, **kwargs): + '''Spawn a pty and return an instance of PtyProcess.''' + return ptyprocess.PtyProcess.spawn(args, **kwargs) + def close(self, force=True): '''This closes the connection with the child application. Note that calling close() more than once is valid. This emulates standard Python |