diff --git a/src/DuskServer.php b/src/DuskServer.php index 3d94ca6..95478fd 100644 --- a/src/DuskServer.php +++ b/src/DuskServer.php @@ -182,7 +182,7 @@ protected function startServer(): void { $this->guardServerStarting(); - $this->process = Process::fromShellCommandline( + $this->process = new Process( command: $this->prepareCommand(), cwd: join_paths($this->basePath(), 'public'), env: array_merge(defined_environment_variables(), [ @@ -224,18 +224,18 @@ protected function guardServerStarting(): void /** * Prepare the command for starting the PHP server. * - * @return string + * @return array */ - protected function prepareCommand(): string + protected function prepareCommand(): array { - return sprintf( - ((OperatingSystem::onWindows() ? '' : 'exec ').'%s -S %s:%s %s -t %s'), - ProcessUtils::escapeArgument((string) (new PhpExecutableFinder())->find(false)), - $this->host, - $this->port, - ProcessUtils::escapeArgument(join_paths(__DIR__, 'server.php')), + return [ + (string) (new PhpExecutableFinder())->find(false), + '-S', + sprintf('%s:%s', $this->host, $this->port), + join_paths(__DIR__, 'server.php'), + '-t', ProcessUtils::escapeArgument(join_paths($this->basePath(), 'public')), - ); + ]; } /**