-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
[Process] Implement Expects #20898
Comments
@alexbowers thanks for taking your time to make this suggestion! I'm not familiar with the |
Expect is used to "listen" to a commends output and upon a match, perform
some action.
A common use case is to automate inputs in bash, for example, filling in a
password, a path etc.
This exists in python as pexpects, ansible as expects, bash as expects.
…On 25 Jan 2017 6:13 pm, "Jakub Zalas" ***@***.***> wrote:
@alexbowers <https://github.com/alexbowers> thanks for taking your time
to make this suggestion! I'm not familiar with the expect command. Would
you mind explaining a use case for this kind of functionality in the
Process component?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#20898 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAzc3nqHiE0n4HozYsBNf53uUURg0fmeks5rV5DOgaJpZM4LLvb1>
.
|
Here are some examples of it in python
https://github.com/pexpect/pexpect/tree/master/examples
…On 25 Jan 2017 6:17 pm, "Alex Bowers" ***@***.***> wrote:
Expect is used to "listen" to a commends output and upon a match, perform
some action.
A common use case is to automate inputs in bash, for example, filling in a
password, a path etc.
This exists in python as pexpects, ansible as expects, bash as expects.
On 25 Jan 2017 6:13 pm, "Jakub Zalas" ***@***.***> wrote:
> @alexbowers <https://github.com/alexbowers> thanks for taking your time
> to make this suggestion! I'm not familiar with the expect command. Would
> you mind explaining a use case for this kind of functionality in the
> Process component?
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#20898 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AAzc3nqHiE0n4HozYsBNf53uUURg0fmeks5rV5DOgaJpZM4LLvb1>
> .
>
|
Not sure what that would mean. What's missing? What's expected? |
I had a quick look into it, but wasn't able to figure it out. I may be able to spend a little more time on it. What is desired is how the What this allows is for you to effectively use Symfony to type input into another command that is running within Symfony. This is useful for typing in passwords, choosing configuration options where flags aren't available, etc. You basically would tell it to wait for an output, and respond with some input. |
The basic syntax I was thinking was: <?php
$cmd = new Process("...");
$cmd->expect("Enter your password:", env("password"));
$cmd->run(); This would cause the command to read the output per line, and when it see's "Enter your password:" then it will put the value from the second argument and "press enter". I can't figure out how to do this unfortunately. How do we read output, and how can we pass input in? |
I can see that in some way I need to be able to call |
Closing as this is not something we should do in core IMHO. |
In linux, there is an
expect
command, which can be setup to deal with interactive programs.Currently, in symfony there is no way to handle this.
Having the ability to setup
expects
and have them resolve using symfony would be very useful.I'm willing to implement this, if it is something that would be considered by the community for merging.
The text was updated successfully, but these errors were encountered: