Skip to content

Commit 5e59fec

Browse files
authored
Merge pull request #63 from dong-zeyu/master
Add **kwargs to PtyProcess.spawn
2 parents 1067dbd + 5420748 commit 5e59fec

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

ptyprocess/ptyprocess.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def __init__(self, pid, fd):
178178
@classmethod
179179
def spawn(
180180
cls, argv, cwd=None, env=None, echo=True, preexec_fn=None,
181-
dimensions=(24, 80), pass_fds=()):
181+
dimensions=(24, 80), pass_fds=(), **kwargs):
182182
'''Start the given command in a child process in a pseudo terminal.
183183
184184
This does all the fork/exec type of stuff for a pty, and returns an
@@ -300,7 +300,7 @@ def spawn(
300300
os._exit(os.EX_OSERR)
301301

302302
# Parent
303-
inst = cls(pid, fd)
303+
inst = cls(pid, fd, **kwargs)
304304

305305
# Set some informational attributes
306306
inst.argv = argv

tests/test_spawn.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ def test_quick_spawn(self):
5757
# because the pty file descriptor was quickly lost after exec().
5858
PtyProcess.spawn(['true'])
5959

60+
def test_spawn_unicode_decoding(self):
61+
p = PtyProcessUnicode.spawn(['printf', '\\344\\272!'], codec_errors='backslashreplace')
62+
assert p.read() == '\\xe4\\xba!'
63+
6064
def _interactive_repl_unicode(self, echo):
6165
"""Test Call and response with echo ON/OFF."""
6266
# given,

0 commit comments

Comments
 (0)