Skip to content

Commit

Permalink
use PHP_OS_FAMILY instead PHP_OS
Browse files Browse the repository at this point in the history
  • Loading branch information
Gemorroj authored and donhardman committed Feb 9, 2023
1 parent 3db8cfb commit 522b446
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/func.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function debug(string $message, string $eol = PHP_EOL): void {
* @return int
*/
function get_parent_pid(): int {
if (strncasecmp(PHP_OS, 'win', 3) === 0) {
if (PHP_OS_FAMILY === 'Windows') {
$pid = getmypid(); // child process ID
$parentPid = (string)shell_exec("wmic process where (processid=$pid) get parentprocessid");
$parentPid = explode("\n", $parentPid);
Expand All @@ -120,7 +120,7 @@ function get_parent_pid(): int {
*/
function process_exists(int $pid): bool {
$isRunning = false;
if (strncasecmp(PHP_OS, 'win', 3) === 0) {
if (PHP_OS_FAMILY === 'Windows') {
$out = [];
exec("TASKLIST /FO LIST /FI \"PID eq $pid\"", $out);
if (sizeof($out) > 1) {
Expand Down
2 changes: 1 addition & 1 deletion test/src/Lib/MockManticoreServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public function start(): void {
* @return void
*/
private function checkParentProc(): void {
if (strncasecmp(PHP_OS, 'win', 3) === 0) {
if (PHP_OS_FAMILY === 'Windows') {
$pid = getmypid();
$parentPidInfo = shell_exec("wmic process where (processid=$pid) get parentprocessid");
if (!isset($parentPidInfo) || $parentPidInfo === false) {
Expand Down

0 comments on commit 522b446

Please sign in to comment.