Skip to content
This repository has been archived by the owner on Oct 5, 2021. It is now read-only.

Commit

Permalink
#take_result_generator return result code
Browse files Browse the repository at this point in the history
  • Loading branch information
GueroSF committed Sep 3, 2021
1 parent 5af39cd commit 932d41b
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/Commands/GenerateClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,22 @@ public function __construct()

/**
* Execute the console command.
*
* @return void
*/
public function handle()
public function handle(): int
{
$this->recursiveClearDirectory($this->outputDir);
$this->generateClientPackage();
if (self::FAILURE === $this->generateClientPackage()) {
return self::FAILURE;
}
$this->patchClientPackage();
$this->copyLicenseToClientPackage();

return self::SUCCESS;
}

protected abstract function patchClientPackage(): void;

private function generateClientPackage(): void
private function generateClientPackage(): int
{
$bin = 'npx @openapitools/openapi-generator-cli';
$i = escapeshellarg($this->apidocDir . DIRECTORY_SEPARATOR . "index.yaml");
Expand All @@ -100,7 +102,9 @@ private function generateClientPackage(): void

$this->info("Generating $this->client client by command: $command");

shell_exec($command);
exec($command, $output, $resultCode);

return $resultCode;
}

private function getGeneratorArguments(): string
Expand Down

0 comments on commit 932d41b

Please sign in to comment.