Skip to content

Commit

Permalink
List all process
Browse files Browse the repository at this point in the history
Signed-off-by: Vitor Mattos <vitor@php.rio>
  • Loading branch information
vitormattos committed May 29, 2023
1 parent b7f5e3b commit 81cb830
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/behat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ jobs:
run: composer install

- name: Run behat
run: vendor/bin/behat
run: |
BEHAT_RUN_AS=$(ls -ld behat.yml | awk '{print $3}')
vendor/bin/behat
3 changes: 2 additions & 1 deletion behat.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
default:
extensions:
PhpBuiltin\Server: ~
PhpBuiltin\Server:
runAs: www-data
7 changes: 5 additions & 2 deletions src/RunServerListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,10 @@ public function start(): void
}

if (!$this->isRunning()) {
throw new ServerException('Failed to start server. Is something already running on port ' . self::$port . '?');
throw new ServerException(
'Failed to start server. Is something already running on port ' . self::$port . "?\n" .
'Full command: ' . $fullCmd
);
}

register_shutdown_function(function () {
Expand Down Expand Up @@ -162,7 +165,7 @@ public function killZombies(): void
'grep "php -S ' . self::$host . '"|' .
'grep -v grep|' .
'sed -e "s/^[[:space:]]*//"|cut -d" " -f1';
$pids = trim(exec($cmd));
$pids = trim(shell_exec($cmd));
$pids = explode("\n", $pids);
foreach ($pids as $pid) {
if ($pid) {
Expand Down
13 changes: 8 additions & 5 deletions tests/psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.12.0@f90118cdeacd0088e7215e64c0c99ceca819e176">
<file src="src/Server.php">
<UndefinedInterfaceMethod>
<code>scalarNode</code>
</UndefinedInterfaceMethod>
<files psalm-version="5.4.0@62db5d4f6a7ae0a20f7cc5a4952d730272fc0863">
<file src="src/RunServerListener.php">
<ForbiddenCode occurrences="1">
<code>shell_exec($cmd)</code>
</ForbiddenCode>
<PossiblyNullArgument occurrences="1">
<code>shell_exec($cmd)</code>
</PossiblyNullArgument>
</file>
</files>

0 comments on commit 81cb830

Please sign in to comment.