Skip to content

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
StyleCIBot committed Nov 12, 2024
1 parent c584036 commit e656c6e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 4 additions & 2 deletions packages/framework/src/Console/Commands/ServeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,9 @@ protected function getOpenCommand(string $osFamily): ?string

protected function runViteProcess(): void
{
if (!$this->isPortAvailable(5173)) {
if (! $this->isPortAvailable(5173)) {
throw new InvalidArgumentException(
'Unable to start Vite server: Port 5173 is already in use. ' .
'Unable to start Vite server: Port 5173 is already in use. '.
'Please stop any other Vite processes and try again.'
);
}
Expand All @@ -208,8 +208,10 @@ protected function isPortAvailable(int $port): bool
$socket = @fsockopen('localhost', $port, $errno, $errstr, 1);
if ($socket !== false) {
fclose($socket);

return false;
}

return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use Illuminate\Contracts\Process\InvokedProcess;
use Illuminate\Support\Facades\Process;
use TypeError;
use InvalidArgumentException;

/**
* @covers \Hyde\Console\Commands\ServeCommand
Expand Down Expand Up @@ -269,7 +268,7 @@ public function testHydeServeCommandWithViteOptionButViteNotRunning()
public function testHydeServeCommandWithViteOptionThrowsWhenPortIsInUse()
{
$socket = stream_socket_server('tcp://127.0.0.1:5173');

$this->artisan('serve --vite')
->expectsOutputToContain('Unable to start Vite server: Port 5173 is already in use')
->assertExitCode(1);
Expand Down

0 comments on commit e656c6e

Please sign in to comment.