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

There is a way to disable the escape_key in interact? #131

Closed
marcosps opened this issue Oct 31, 2014 · 3 comments
Closed

There is a way to disable the escape_key in interact? #131

marcosps opened this issue Oct 31, 2014 · 3 comments
Labels

Comments

@marcosps
Copy link

Hi people,

I didn't find a way to disable the escape key in inteact. My workaround was to do a while True and always call interact. There is a better way to solve this?

Thanks.

@jquast
Copy link
Member

jquast commented Oct 31, 2014

Just set escape_character to something else when calling interact. for example, for ^c:

child.interact(escape_character=chr(3))

If using python2, you can set it to 'None'. But I think this would be an error for python3, might be a bug https://github.com/pexpect/pexpect/blob/master/pexpect/__init__.py#L1645

@marcosps
Copy link
Author

WOW! I tried to set the escape_character as None, and not as 'None'. Now it's working! Thanks!

I'm using Python 2.7 here, and this works great.

Thanks again!

@jquast
Copy link
Member

jquast commented Oct 31, 2014

Correction for anybody else: the raw None value doesn't work in python2, either.

Setting any valid multi-character is fine, like 'blah-blah'. The only way to cause it to escape would be to paste (or very quickly type) the phrase 'blah-blah'. Opened Issue #132 for enhancement to disable entirely.

jquast added a commit that referenced this issue Sep 18, 2015
For those who wish to disable the ability to escape using
escape_character 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 related value behavior.

This closes #131 #132 #167
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants