Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ServerProcessInspector interface #679

Merged
merged 3 commits into from
Apr 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Commands/Concerns/InteractsWithServers.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ trait InteractsWithServers
* Run the given server process.
*
* @param \Symfony\Component\Process\Process $server
* @param \Laravel\Octane\Swoole\ServerProcessInspector|\Laravel\Octane\RoadRunner\ServerProcessInspector $inspector
* @param \Laravel\Octane\Contracts\ServerProcessInspector $inspector
* @param string $type
* @return int
*/
Expand Down
27 changes: 27 additions & 0 deletions src/Contracts/ServerProcessInspector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Laravel\Octane\Contracts;

interface ServerProcessInspector
{
/**
* Determine if the server process is running.
*
* @return bool
*/
public function serverIsRunning(): bool;

/**
* Reload the workers.
*
* @return void
*/
public function reloadServer(): void;

/**
* Stop the server.
*
* @return bool
*/
public function stopServer(): bool;
}
3 changes: 2 additions & 1 deletion src/RoadRunner/ServerProcessInspector.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

namespace Laravel\Octane\RoadRunner;

use Laravel\Octane\Contracts\ServerProcessInspector as ServerProcessInspectorContract;
use Laravel\Octane\PosixExtension;
use Laravel\Octane\RoadRunner\Concerns\FindsRoadRunnerBinary;
use Laravel\Octane\SymfonyProcessFactory;
use RuntimeException;
use Symfony\Component\Process\Process;

class ServerProcessInspector
class ServerProcessInspector implements ServerProcessInspectorContract
{
use FindsRoadRunnerBinary;

Expand Down
3 changes: 2 additions & 1 deletion src/Swoole/ServerProcessInspector.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

namespace Laravel\Octane\Swoole;

use Laravel\Octane\Contracts\ServerProcessInspector as ServerProcessInspectorContract;
use Laravel\Octane\Exec;

class ServerProcessInspector
class ServerProcessInspector implements ServerProcessInspectorContract
{
public function __construct(
protected SignalDispatcher $dispatcher,
Expand Down