Skip to content

Commit

Permalink
Improved running server detection using lsof for multiple processes…
Browse files Browse the repository at this point in the history
… listing the same port.
  • Loading branch information
AlexSkrypnyk committed Jan 18, 2025
1 parent 9dc0230 commit 2fa3ebf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/DrevOps/BehatPhpServer/PhpServerContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ protected function getPid(int $port): int {
$this->debug(sprintf('Finding PID of the PHP server process on port %s.', $port));

if (shell_exec('which lsof')) {
$command = sprintf("lsof -i -P -n 2>/dev/null | grep ':%s'", $port);
$command = sprintf("lsof -i -P -n 2>/dev/null | grep 'php' | grep ':%s'", $port);
$type = 'lsof';
}
elseif (shell_exec('which netstat')) {
Expand Down

0 comments on commit 2fa3ebf

Please sign in to comment.