[v2.3.7] interact -re PATTERN: detach upon matching a specified pattern
clarkwang opened this issue · 2 comments
clarkwang commented
- I used to think this is not quite useful. Changed my idea recently when writing a script which needs to input password in an interactive way for security's sake.
- The whole logic can be done in the client side. Don't complicate the server side.
A bit more background:
In a corporate env it's not appropriate to ask users to pass their corporate account's passwords in command line. After spawning a program, when it prompts for the password, enter interactive mode and ask users to input their password manually, then automatically exit interactive mode when matching a specified pattern, then continue running the rest of the script.
clarkwang commented
Will only support -re PATTERN
:
sexpect interact [-nocase | -icase | -i] [-cstring | -cstr | -c] -re PATTERN
clarkwang commented
There are quite some issues if the interact -re PATTERN
logic is implemented in client side.
sexpect sp bash --norc
sexpect s -cr 'echo {a..z} | tr -d " " '
sexpect i -re abc
sexpect ex -re def
<== This is supposed to succeed.
Sounds like the logic has to be moved to the server side.