Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5640cf9

Browse files
greg-1-andersonweitzman
authored andcommitted
Fixes #3859: Allow input to be piped to sql:cli (#3866)
1 parent 553c144 commit 5640cf9

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/Commands/sql/SqlCommands.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Drush\Exec\ExecTrait;
1010
use Drush\Sql\SqlBase;
1111
use Consolidation\OutputFormatters\StructuredData\PropertyList;
12+
use Symfony\Component\Console\Input\InputInterface;
1213

1314
class SqlCommands extends DrushCommands
1415
{
@@ -137,11 +138,13 @@ public function drop($options = [])
137138
* @remote-tty
138139
* @bootstrap max configuration
139140
*/
140-
public function cli($options = ['extra' => self::REQ])
141+
public function cli(InputInterface $input, $options = ['extra' => self::REQ])
141142
{
142143
$sql = SqlBase::create($options);
143144
$process = $this->processManager()->shell($sql->connect(), null, $sql->getEnv());
144-
$process->setTty(true);
145+
$process->setTty($this->getConfig()->get('ssh.tty', $input->isInteractive()));
146+
$process->setInput(STDIN);
147+
$process->mustRun($process->showRealtime());
145148
$process->mustRun();
146149
}
147150

src/Runtime/RedispatchHook.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ public function redispatch(InputInterface $input)
9797
$aliasRecord = $this->siteAliasManager()->getSelf();
9898
$process = $this->processManager->drushSiteProcess($aliasRecord, $redispatchArgs, $redispatchOptions);
9999
$process->setTty($this->getConfig()->get('ssh.tty', $input->isInteractive()));
100+
$process->setInput(STDIN);
100101
$process->mustRun($process->showRealtime());
101102

102103
return $this->exitEarly($process->getExitCode());

0 commit comments

Comments
 (0)