Skip to content

Commit

Permalink
CLI-1130: Workaround for broken Drush SQL import (#1650)
Browse files Browse the repository at this point in the history
* CLI-1130: Workaround for broken Drush SQL import

* fix
  • Loading branch information
danepowell authored Dec 14, 2023
1 parent 9ec86da commit aa2e70c
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/Helpers/LocalMachineHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function commandExists(mixed $command): bool {
return (bool) $this->installedBinaries[$command];
}
$osCommand = OsInfo::isWindows() ? ['where', $command] : ['which', $command];
$exists = $this->execute($osCommand, NULL, NULL, FALSE)->isSuccessful();
$exists = $this->execute($osCommand, NULL, NULL, FALSE, NULL, NULL, FALSE)->isSuccessful();
$this->installedBinaries[$command] = $exists;
return $exists;
}
Expand All @@ -71,13 +71,10 @@ public function checkRequiredBinariesExist(array $binaries = []): void {

/**
* Executes a buffered command.
*
* @param array $cmd The command to execute.
* @param null $callback A function to run while waiting for the process to complete.
*/
public function execute(array $cmd, callable $callback = NULL, string $cwd = NULL, ?bool $printOutput = TRUE, float $timeout = NULL, array $env = NULL): Process {
public function execute(array $cmd, callable $callback = NULL, string $cwd = NULL, ?bool $printOutput = TRUE, float $timeout = NULL, array $env = NULL, bool $stdin = TRUE): Process {
$process = new Process($cmd);
$process = $this->configureProcess($process, $cwd, $printOutput, $timeout, $env);
$process = $this->configureProcess($process, $cwd, $printOutput, $timeout, $env, $stdin);
return $this->executeProcess($process, $callback, $printOutput);
}

Expand Down Expand Up @@ -106,8 +103,8 @@ public function executeFromCmd(string $cmd, callable $callback = NULL, string $c
* @param string|null $cwd
* @param array|null $env
*/
private function configureProcess(Process $process, string $cwd = NULL, ?bool $printOutput = TRUE, float $timeout = NULL, array $env = NULL): Process {
if (function_exists('posix_isatty') && !@posix_isatty(STDIN)) {
private function configureProcess(Process $process, string $cwd = NULL, ?bool $printOutput = TRUE, float $timeout = NULL, array $env = NULL, bool $stdin = TRUE): Process {
if (function_exists('posix_isatty') && !@posix_isatty(STDIN) && $stdin) {
$process->setInput(STDIN);
}
if ($cwd) {
Expand Down

0 comments on commit aa2e70c

Please sign in to comment.