mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'PHP-8.3'
This commit is contained in:
commit
0a34716667
2 changed files with 17 additions and 5 deletions
|
@ -3,7 +3,7 @@ FPM: Set CLOEXEC on the listen and connection socket
|
|||
--SKIPIF--
|
||||
<?php
|
||||
require_once "skipif.inc";
|
||||
FPM\Tester::skipIfShellCommandFails('lsof -v 2> /dev/null');
|
||||
FPM\Tester::skipIfShellCommandFails('lsof -v', 'lsof-org/lsof');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
|
|
@ -342,12 +342,24 @@ class Tester
|
|||
* Skip test if supplied shell command fails.
|
||||
*
|
||||
* @param string $command
|
||||
* @param string|null $expectedPartOfOutput
|
||||
*/
|
||||
static public function skipIfShellCommandFails($command)
|
||||
static public function skipIfShellCommandFails(string $command, string $expectedPartOfOutput = null)
|
||||
{
|
||||
$output = system($command, $code);
|
||||
if ($code) {
|
||||
die("skip command '$command' faield with code $code and output: $output");
|
||||
$result = exec("$command 2>&1", $output, $code);
|
||||
if ($result === false || $code) {
|
||||
die("skip command '$command' faieled with code $code");
|
||||
}
|
||||
if (!is_null($expectedPartOfOutput)) {
|
||||
if (is_array($output)) {
|
||||
foreach ($output as $line) {
|
||||
if (str_contains($line, $expectedPartOfOutput)) {
|
||||
// string found so no need to skip
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
die("skip command '$command' did not contain output '$expectedPartOfOutput'");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue