diff options
-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 |