From 1a8bd9750d7023b32b647677874211b38a3772f6 Mon Sep 17 00:00:00 2001 From: Jeff Quast Date: Tue, 15 Sep 2015 17:26:50 -0700 Subject: Allow {p}.interact(escape_character=None) For those who wish to disable the ability to escape using process (likely, human) input until normal process termination, they may now set the value of escape_character to None. Some of the related docstring on escape_character was made more brief and clear about its behaviour. --- tests/test_interact.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/test_interact.py') diff --git a/tests/test_interact.py b/tests/test_interact.py index e635cb0..21d083b 100755 --- a/tests/test_interact.py +++ b/tests/test_interact.py @@ -57,6 +57,18 @@ class InteractTestCase (PexpectTestCase.PexpectTestCase): assert not p.isalive() assert p.exitstatus == 0 + def test_interact_escape_None(self): + " Return only after Termination when `escape_character=None'. " + p = pexpect.spawn('{self.interact_py} --no-escape'.format(self=self), + timeout=5, env=self.env) + p.expect('') + p.sendcontrol('d') + p.expect('') + p.expect_exact('Escaped interact') + p.expect(pexpect.EOF) + assert not p.isalive() + assert p.exitstatus == 0 + def test_interact_spawn_eof(self): " Ensure subprocess receives EOF and exit. " p = pexpect.spawn(self.interact_py, timeout=5, env=self.env) -- cgit v1.2.1