Skip to content

Commit

Permalink
Merge pull request #1 from fritzmg/patch-1
Browse files Browse the repository at this point in the history
Add support for Windows
  • Loading branch information
Toflar committed Feb 21, 2024
2 parents 760e346 + 80762e3 commit 53867a5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Supervisor.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,14 @@ private function executeLocked(\Closure $closure): void

private function isRunningPid(int $pid): bool
{
if ('\\' === \DIRECTORY_SEPARATOR) {
$process = new Process(['tasklist', '/FI', "PID eq $pid"]);
$process->run();

// Symfony Process starts Windows processes via cmd.exe
return str_contains($process->getOutput(), 'cmd.exe');
}

$process = new Process(['ps', '-p', $pid]);
$exitCode = $process->run();

Expand Down

0 comments on commit 53867a5

Please sign in to comment.