diff options
author | Giovan Isa Musthofa <giovanism@outlook.co.id> | 2018-10-08 21:40:35 +0700 |
---|---|---|
committer | giovanism <giovanism@outlook.co.id> | 2019-04-16 08:13:05 +0700 |
commit | 28773782aeff5fd17eb1b108abc55d598318d3e2 (patch) | |
tree | e306507c3a3200994f7aeaff33a3b7b69cc3d6e6 | |
parent | 15913d9457cde95bb0b2c92ee19ff6a8f1321833 (diff) | |
download | pexpect-28773782aeff5fd17eb1b108abc55d598318d3e2.tar.gz |
interact: Add Python 3 compatibility warning
Close https://github.com/pexpect/pexpect/issues/517
-rw-r--r-- | pexpect/pty_spawn.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/pexpect/pty_spawn.py b/pexpect/pty_spawn.py index 691c2c6..58d57f7 100644 --- a/pexpect/pty_spawn.py +++ b/pexpect/pty_spawn.py @@ -752,10 +752,14 @@ class spawn(SpawnBase): child process in interact mode is duplicated to the given log. You may pass in optional input and output filter functions. These - functions should take a string and return a string. The output_filter - will be passed all the output from the child process. The input_filter - will be passed all the keyboard input from the user. The input_filter - is run BEFORE the check for the escape_character. + functions should take bytes array and return bytes array too. Even + with ``encoding='utf-8'`` support, meth:`interact` will always pass + input_filter and output_filter bytes. You may need to wrap your + function to decode and encode back to UTF-8. + + The output_filter will be passed all the output from the child process. + The input_filter will be passed all the keyboard input from the user. + The input_filter is run BEFORE the check for the escape_character. Note that if you change the window size of the parent the SIGWINCH signal will not be passed through to the child. If you want the child @@ -775,7 +779,7 @@ class spawn(SpawnBase): signal.signal(signal.SIGWINCH, sigwinch_passthrough) p.interact() ''' - + # Flush the buffer. self.write_to_stdout(self.buffer) self.stdout.flush() |