Skip to content

Commit 6b166ee

Browse files
committed
Controlling when pcntl is enabled
1 parent ca677bb commit 6b166ee

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,12 @@
2727
"description" : "Codeception extension for PhireMock. Allows to stub remote services for HTTP requests.",
2828
"license" : "GPL-3.0+",
2929
"require" : {
30-
"php" : ">=5.5",
30+
"php" : ">=5.6",
3131
"mcustiel/phiremock": "^1.3",
3232
"codeception/codeception" : "^2.0",
3333
"symfony/process": "^3.1|^2.7.15"
34+
},
35+
"suggest" : {
36+
"ext-pcntl" : "Allows phiremock-codeception-extension to send system signals to phiremock process"
3437
}
3538
}

src/Extension/PhiremockProcess.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
namespace Codeception\Extension;
2020

2121
use Symfony\Component\Process\Process;
22+
use Codeception\PHPUnit\Constraint\Page;
2223

2324
/**
2425
* Manages the current running Phiremock process.
@@ -66,7 +67,7 @@ public function start($ip, $port, $path, $logsPath, $debug, $expectationsPath)
6667
*/
6768
public function stop()
6869
{
69-
if (!$this->isWindows()) {
70+
if ($this->isPcntlEnabled()) {
7071
$this->process->signal(SIGTERM);
7172
$this->process->stop(3, SIGKILL);
7273
}
@@ -129,4 +130,12 @@ private function isWindows()
129130
{
130131
return PHP_OS === 'WIN32' || PHP_OS === 'WINNT' || PHP_OS === 'Windows';
131132
}
133+
134+
/**
135+
* @return boolean
136+
*/
137+
private function isPcntlEnabled()
138+
{
139+
return !$this->isWindows() && defined(SIGTERM);
140+
}
132141
}

0 commit comments

Comments
 (0)