Skip to content

Commit

Permalink
more process priority testing on the github test machine-environment
Browse files Browse the repository at this point in the history
Adding documentation for the result of renice on various systems.
  • Loading branch information
belisoful committed Jul 25, 2023
1 parent b93ba6c commit 469417d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions framework/Util/Helpers/TProcessHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,9 @@ public static function setProcessPriority(int $priority, ?int $pid = null): bool
}
$priority -= $pp;
$result = shell_exec("exec renice -n $priority -p $pid");
// On MacOS, working properly consists of returning nothing. only errors return
// On the github linux test system it return "3539 (process ID) old priority 0, new priority 8"
// for an error, it return: ...
echo('--' . $result . '--');
if (is_string($result) && strlen($result) > 1) {
return false;
Expand Down
1 change: 1 addition & 0 deletions tests/unit/Util/Helpers/TProcessHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ public function testIsRunning_Kill_Priority()
self::assertTrue(TProcessHelper::isRunning($pid));

self::assertTrue(is_int($processPriority = TProcessHelper::getProcessPriority($pid)));
self::assertTrue(TProcessHelper::setProcessPriority(TProcessHelper::WINDOWS_ABOVE_NORMAL_PRIORITY, $pid));
self::assertTrue(TProcessHelper::setProcessPriority(TProcessHelper::WINDOWS_BELOW_NORMAL_PRIORITY, $pid));
self::assertEquals(TProcessHelper::WINDOWS_BELOW_NORMAL_PRIORITY, TProcessHelper::getProcessPriority($pid));

Expand Down

0 comments on commit 469417d

Please sign in to comment.