Skip to content

Commit

Permalink
CLI-1282: [remote:aliases:download] warning on read-only directory
Browse files Browse the repository at this point in the history
  • Loading branch information
danepowell committed Apr 1, 2024
1 parent a1f59d3 commit 1c159d0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Command/Remote/AliasesDownloadCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,13 @@ protected function downloadDrush9Aliases(InputInterface $input, string $aliasVer
$drushFiles[] = $baseDir . '/' . $file->getFileName();
}
}
$archive->extractTo($drushAliasesDir, $drushFiles, TRUE);
try {
// Throws warnings on permissions errors.
@$archive->extractTo($drushAliasesDir, $drushFiles, TRUE);
}
catch (\Exception) {
throw new AcquiaCliException('Could not extract aliases to {destination}', ['destination' => $drushAliasesDir]);

Check warning on line 138 in src/Command/Remote/AliasesDownloadCommand.php

View check run for this annotation

Codecov / codecov/patch

src/Command/Remote/AliasesDownloadCommand.php#L137-L138

Added lines #L137 - L138 were not covered by tests
}
}

protected function downloadDrush8Aliases(string $aliasVersion, string $drushArchiveTempFilepath, string $drushAliasesDir): void {
Expand Down
2 changes: 2 additions & 0 deletions src/EventListener/ExceptionListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ public function onConsoleError(ConsoleErrorEvent $event): void {
case 'This machine is not yet authenticated with Site Factory.':
$this->helpMessages[] = 'Run `acli auth:acsf-login` to re-authenticate with Site Factory.';
break;
case 'Could not extract aliases to {destination}':
$this->helpMessages[] = 'Check that you have write access to the directory';
}
}

Expand Down
4 changes: 4 additions & 0 deletions tests/phpunit/src/Misc/ExceptionListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ public function providerTestHelp(): array {
new AcquiaCliException('This machine is not yet authenticated with Site Factory.'),
'Run `acli auth:acsf-login` to re-authenticate with Site Factory.',
],
[
new AcquiaCliException('Could not extract aliases to {destination}'),
'Check that you have write access to the directory',
],
[
new ApiErrorException((object) ['error' => '', 'message' => "There are no available Cloud IDEs for this application.\n"]),
'Delete an existing IDE via <bg=blue;fg=white;options=bold>acli ide:delete</> or contact your Account Manager or Acquia Sales to purchase additional IDEs.',
Expand Down

0 comments on commit 1c159d0

Please sign in to comment.