Skip to content

Commit

Permalink
Throw a more descriptive exception when the binary was not created
Browse files Browse the repository at this point in the history
When the build command fails and a binary was not created, this results in an error like `rename(app.phar, builds/app): the system cannot find the file specified `. This is not very descriptive to the actual issue, so this PR adds a check to thrown an exception if the file was not created. This will make debugging easier.

See laravel-zero/laravel-zero#461
  • Loading branch information
caendesilva authored Dec 1, 2023
1 parent 517dddb commit 7258023
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Commands/BuildCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ private function compile(string $name): BuildCommand
$this->task(' 2. <fg=yellow>Compile</> into a single file');

$this->output->newLine();

if (! File::exists($this->app->basePath($this->getBinary()) . '.phar')) {
throw new \RuntimeException('Failed to compile the application.');
}

File::move($this->app->basePath($this->getBinary()).'.phar', $this->app->buildsPath($name));

Expand Down

0 comments on commit 7258023

Please sign in to comment.