From 18ad4d32dedecf7535aa2f06e60644c020e5c2b5 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Thu, 27 Jun 2024 20:00:56 +0800 Subject: [PATCH] wip Signed-off-by: Mior Muhammad Zaki --- src/DuskServer.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/DuskServer.php b/src/DuskServer.php index 6f9883a..38b3c6c 100644 --- a/src/DuskServer.php +++ b/src/DuskServer.php @@ -208,7 +208,7 @@ protected function startServer(): void { $this->guardServerStarting(); - $this->process = Process::fromShellCommandline( + $this->process = new Process( $this->prepareCommand(), "{$this->basePath()}/public", array_merge(defined_environment_variables(), [ @@ -250,18 +250,18 @@ protected function guardServerStarting() /** * 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(__DIR__.'/server.php'), - ProcessUtils::escapeArgument("{$this->basePath()}/public") - ); + return ray()->pass(array_filter([ + (string) (new PhpExecutableFinder())->find(false), + '-S', + sprintf('%s:%s', $this->host, $this->port), + __DIR__.'/server.php', + '-t', + sprintf('%s', ProcessUtils::escapeArgument("{$this->basePath()}/public")), + ])); } /**