Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add **kwargs to PtyProcess.spawn #63

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ptyprocess/ptyprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def __init__(self, pid, fd):
@classmethod
def spawn(
cls, argv, cwd=None, env=None, echo=True, preexec_fn=None,
dimensions=(24, 80), pass_fds=()):
dimensions=(24, 80), pass_fds=(), **kwargs):
'''Start the given command in a child process in a pseudo terminal.

This does all the fork/exec type of stuff for a pty, and returns an
Expand Down Expand Up @@ -300,7 +300,7 @@ def spawn(
os._exit(os.EX_OSERR)

# Parent
inst = cls(pid, fd)
inst = cls(pid, fd, **kwargs)

# Set some informational attributes
inst.argv = argv
Expand Down
4 changes: 4 additions & 0 deletions tests/test_spawn.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ def test_quick_spawn(self):
# because the pty file descriptor was quickly lost after exec().
PtyProcess.spawn(['true'])

def test_spawn_unicode_decoding(self):
p = PtyProcessUnicode.spawn(['printf', '\\344\\272!'], codec_errors='backslashreplace')
assert p.read() == '\\xe4\\xba!'

def _interactive_repl_unicode(self, echo):
"""Test Call and response with echo ON/OFF."""
# given,
Expand Down