Skip to content

Commit

Permalink
Issue hechoendrupal#4330: Replace ProcessBuilder class with Process i…
Browse files Browse the repository at this point in the history
…n db client command.
  • Loading branch information
LOBsTerr committed Sep 15, 2022
1 parent 6bd5fa0 commit 02bc1f4
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/Command/Database/ClientCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Process\ProcessBuilder;
use Symfony\Component\Process\Process;
use Drupal\Console\Core\Command\Command;
use Drupal\Console\Command\Shared\ConnectTrait;

class ClientCommand extends Command
{

use ConnectTrait;

/**
Expand All @@ -25,7 +26,9 @@ protected function configure()
{
$this
->setName('database:client')
->setDescription($this->trans('commands.database.client.description'))
->setDescription(
$this->trans('commands.database.client.description')
)
->addArgument(
'database',
InputArgument::OPTIONAL,
Expand All @@ -49,23 +52,23 @@ protected function execute(InputInterface $input, OutputInterface $output)
{
$database = $input->getArgument('database');
$learning = $input->getOption('learning');
$target = $input->getArgument('target');
$target = $input->getArgument('target');

$databaseConnection = $this->resolveConnection($database, $target);
$connection = $this->getConnectionString($databaseConnection);
$connection = $this->getConnectionString($databaseConnection);

if ($learning) {
$this->getIo()->commentBlock(
sprintf(
$this->trans('commands.database.client.messages.connection'),
$this->trans(
'commands.database.client.messages.connection'
),
$connection
)
);
}

$processBuilder = new ProcessBuilder([]);
$processBuilder->setArguments(explode(' ', $connection));
$process = $processBuilder->getProcess();
$process = new Process(explode(' ', $connection));
$process->setTty('true');
$process->run();

Expand All @@ -75,4 +78,5 @@ protected function execute(InputInterface $input, OutputInterface $output)

return 0;
}

}

0 comments on commit 02bc1f4

Please sign in to comment.