Skip to content

Commit

Permalink
Fix #175: Fix serve under Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
samdark committed Mar 31, 2023
1 parent a26e643 commit 9c0b7fc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Expand Up @@ -2,7 +2,7 @@

## 2.0.1 under development

- no changes in this release.
- Bug #175: Fix `serve` under Windows (samdark)

## 2.0.0 February 17, 2023

Expand Down
8 changes: 7 additions & 1 deletion src/Command/Serve.php
Expand Up @@ -135,7 +135,13 @@ protected function execute(InputInterface $input, OutputInterface $output): int
return ExitCode::OK;
}

passthru('PHP_CLI_SERVER_WORKERS=' . $workers . ' "' . PHP_BINARY . '"' . " -S $address -t \"$documentRoot\" $router");
$command = '"' . PHP_BINARY . '"' . " -S $address -t \"$documentRoot\" $router";

if (DIRECTORY_SEPARATOR !== '\\') {
$command = 'PHP_CLI_SERVER_WORKERS=' . $workers . ' ' . $command;
}

passthru($command);

return ExitCode::OK;
}
Expand Down
2 changes: 2 additions & 0 deletions src/SymfonyEventDispatcher.php
Expand Up @@ -17,7 +17,9 @@ public function __construct(private PsrEventDispatcherInterface $dispatcher)
* Dispatches an event to all registered listeners.
*
* @psalm-template T as object
*
* @psalm-param T $event
*
* @psalm-return T
*/
public function dispatch(object $event, string $eventName = null): object
Expand Down

0 comments on commit 9c0b7fc

Please sign in to comment.