Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NewCommand does not check for herd valet existence #342

Closed
Anticom opened this issue May 31, 2024 · 5 comments
Closed

NewCommand does not check for herd valet existence #342

Anticom opened this issue May 31, 2024 · 5 comments
Labels

Comments

@Anticom
Copy link

Anticom commented May 31, 2024

Installer Version

5.8.1

Description

620f1b3 introduced automatic inference of TLD in case either herd or valet is present on the host machine.
However this method does not check for existence of those tools first, causing the following error to be thrown when generating a new laravel application:

In Process.php line 371:

  The command "'herd' 'tld' '-v'" failed.

  Working directory: /path/to/workingdirectory

  Error: proc_open(): posix_spawn() failed: No such file or directory

Not only is this bad UX but most improtantly this causes laravel new to exit with a non-zero code. This may break scripts created by user automating project scaffolding.

Steps To Reproduce

  1. Make sure neither herd nor valet is on your host system
  2. run laravel new foo
  3. choose default options for promts
@driesvints
Copy link
Member

driesvints commented May 31, 2024

cc @xiCO2k: could you maybe send a fix for this one?

@driesvints driesvints added the bug label May 31, 2024
@Anticom
Copy link
Author

Anticom commented May 31, 2024

Additional info:
I also just noticed NewCommand does not appear to run to completion. I chose to initialize the git repo for me which did not happen.

@Anticom
Copy link
Author

Anticom commented May 31, 2024

I re-ran the command with very verbose output, yielding

In Process.php line 371:

  [Symfony\Component\Process\Exception\ProcessStartFailedException]
  The command "'herd' 'tld' '-v'" failed.

  Working directory: /path/to/workingdirectory

  Error: proc_open(): posix_spawn() failed: No such file or directory


Exception trace:
  at /Users/anticom/.composer/vendor/symfony/process/Process.php:371
 Symfony\Component\Process\Process->start() at /Users/anticom/.composer/vendor/symfony/process/Process.php:249
 Symfony\Component\Process\Process->run() at /Users/anticom/.composer/vendor/laravel/installer/src/NewCommand.php:766
 Laravel\Installer\Console\NewCommand->getTld() at /Users/anticom/.composer/vendor/laravel/installer/src/NewCommand.php:751
 Laravel\Installer\Console\NewCommand->generateAppUrl() at /Users/anticom/.composer/vendor/laravel/installer/src/NewCommand.php:185
 Laravel\Installer\Console\NewCommand->execute() at /Users/anticom/.composer/vendor/symfony/console/Command/Command.php:279
 Symfony\Component\Console\Command\Command->run() at /Users/anticom/.composer/vendor/symfony/console/Application.php:1029
 Symfony\Component\Console\Application->doRunCommand() at /Users/anticom/.composer/vendor/symfony/console/Application.php:316
 Symfony\Component\Console\Application->doRun() at /Users/anticom/.composer/vendor/symfony/console/Application.php:167
 Symfony\Component\Console\Application->run() at /Users/anticom/.composer/vendor/laravel/installer/bin/laravel:13
 include() at /Users/anticom/.composer/vendor/bin/laravel:119

Looking at Process.php:371 a ProcessStartFailedException is thrown there:

        // ...
        if (!\is_resource($process)) {
            throw new ProcessStartFailedException($this, $lastError);
        }
        // ...

@xiCO2k
Copy link
Contributor

xiCO2k commented May 31, 2024

On it

@xiCO2k
Copy link
Contributor

xiCO2k commented May 31, 2024

PR: #343

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants