-
Notifications
You must be signed in to change notification settings - Fork 305
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
Add setProcessInput and deprecate setInput. #1034
Add setProcessInput and deprecate setInput. #1034
Conversation
docs/tasks/Base.md
Outdated
@@ -21,6 +21,7 @@ if ($this->taskExec('phpunit .')->run()->wasSuccessful()) { | |||
|
|||
* `simulate($context)` {@inheritdoc} | |||
* `setOutput($output)` Sets the Console Output. | |||
* `setProcessInput($output)` Sets the input for the command. Similar to a pipe like `echo "input" | cat`. Usually followed by a call to `->interactive(false)` to avoid other inputs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo, $output
instead of $input.
This does not appear to be done, currently. Are you proposing that it should be? If there are no use cases where you need a tty with stdin redirection (seems reasonable to me), then the right time to make this behavior change would be now, when the new method name is introduced. The deprecated method should maintain the old behavior. |
Thanks for having a look. |
src/Common/ExecTrait.php
Outdated
public function setInput($input) | ||
{ | ||
trigger_error('setInput() is deprecated. Please use setProcessInput(().', E_USER_DEPRECATED); | ||
return $this->setProcessInput($input); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setInput
should maintain old behavior and not set interactive false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably not necessary but I can't prove that it won't cause a problem for someone.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But you are right, better keep the same behavior for the deprecated method.
Thanks! |
Overview
This pull request:
Summary
Use a different method name to set the input for a process as the current one is overridden by the
InputAwareTrait
used by theCollectionBuilder
Description
I was trying to provide a docker-compose.yml file via stdin by doing
but the
setInput()
that ends up being called is not the one on theExecTrait
so I propose to deprecate setInput as it wasn't working anyway and add a new method name that is more descriptive.I am not sure that
interactive
should also be set to false automatically when you provide input for the process but that can be a discussion for another issue.