diff --git a/docs/tasks/Base.md b/docs/tasks/Base.md index 25fa7171e..d5a2c6ef1 100644 --- a/docs/tasks/Base.md +++ b/docs/tasks/Base.md @@ -21,6 +21,7 @@ if ($this->taskExec('phpunit .')->run()->wasSuccessful()) { * `simulate($context)` {@inheritdoc} * `setOutput($output)` Sets the Console Output. +* `setProcessInput($input)` Sets the input for the command. Similar to a pipe like `echo "input" | cat`. * `dir($dir)` Changes working directory of command * `arg($arg)` Pass argument to executable. Its value will be automatically escaped. * `args($args)` Pass methods parameters as arguments to executable. Argument values @@ -49,7 +50,7 @@ $this->taskExecStack() * `executable($executable)` * `param string` $executable * `exec($command)` * `param string|string[]|CommandInterface` $command * `stopOnFail($stopOnFail = null)` * `param bool` $stopOnFail -* `result($result)` +* `result($result)` * `setOutput($output)` Sets the Console Output. * `dir($dir)` Changes working directory of command @@ -94,7 +95,7 @@ $this->taskSymfonyCommand(new ModelGeneratorCommand()) ``` * `arg($arg, $value)` * `param string` $arg -* `opt($option, $value = null)` +* `opt($option, $value = null)` * `setOutput($output)` Sets the Console Output. diff --git a/src/Common/ExecTrait.php b/src/Common/ExecTrait.php index a070fc8a4..6b380361a 100644 --- a/src/Common/ExecTrait.php +++ b/src/Common/ExecTrait.php @@ -215,8 +215,26 @@ public function envVars(array $env) * * @return $this */ + public function setProcessInput($input) + { + $this->input = $input; + // A tty should not be allocated when the input is provided. + $this->interactive(false); + return $this; + } + + /** + * Pass an input to the process. Can be resource created with fopen() or string + * + * @param resource|string $input + * + * @return $this + * + * @deprecated + */ public function setInput($input) { + trigger_error('setInput() is deprecated. Please use setProcessInput(().', E_USER_DEPRECATED); $this->input = $input; return $this; }