summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Quast <contact@jeffquast.com>2015-10-06 07:55:10 -0700
committerJeff Quast <contact@jeffquast.com>2015-10-06 07:55:10 -0700
commitd1a6f1eaacbc1a262d54b067d9b787fce24748ae (patch)
tree19bf3e134c012314b2a20c5fc393b3cd2b4b7fb6
parent1ca0a834c94ce1f198eb77306d8e08ec56c4f177 (diff)
parentfa5ece24786d659e0bcd8423d66cbaa51b3d8d6c (diff)
downloadpexpect-git-d1a6f1eaacbc1a262d54b067d9b787fce24748ae.tar.gz
Merge pull request #274 from takluyver/i272
Encode command line args for unicode-mode spawn
-rw-r--r--pexpect/pty_spawn.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/pexpect/pty_spawn.py b/pexpect/pty_spawn.py
index 1d9554b..7fc27fe 100644
--- a/pexpect/pty_spawn.py
+++ b/pexpect/pty_spawn.py
@@ -285,6 +285,11 @@ class spawn(SpawnBase):
if dimensions is not None:
kwargs['dimensions'] = dimensions
+ if self.encoding is not None:
+ # Encode command line using the specified encoding
+ 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)