diff --git a/src/Roots/Acorn/Console/Commands/AcornInstallCommand.php b/src/Roots/Acorn/Console/Commands/AcornInstallCommand.php index 39435a53..e4376428 100644 --- a/src/Roots/Acorn/Console/Commands/AcornInstallCommand.php +++ b/src/Roots/Acorn/Console/Commands/AcornInstallCommand.php @@ -24,6 +24,13 @@ class AcornInstallCommand extends Command */ protected $description = 'Install Acorn into the application'; + /** + * The Acorn repository URL. + * + * @var string + */ + protected $repoUrl = 'https://github.com/roots/acorn'; + /** * Execute the console command. */ @@ -119,12 +126,18 @@ protected function askToStar(): void label: '🎉 All done! Would you like to show love by starring Acorn on GitHub?', default: true, )) { - match (PHP_OS_FAMILY) { - 'Darwin' => exec('open https://github.com/roots/acorn'), - 'Linux' => exec('xdg-open https://github.com/roots/acorn'), - 'Windows' => exec('start https://github.com/roots/acorn'), + $opened = match (PHP_OS_FAMILY) { + 'Darwin' => shell_exec('open ' . $this->repoUrl . ' 2>/dev/null') !== null, + 'Linux' => shell_exec('xdg-open ' . $this->repoUrl . ' 2>/dev/null') !== null, + 'Windows' => shell_exec('start ' . $this->repoUrl . ' 2>nul') !== null, + default => false, }; + if (!$opened) { + $this->components->info('Please visit this URL to star the repository:'); + $this->components->info($this->repoUrl); + } + $this->components->info('Thank you!'); } }