Extract process-related functions from Utils into a separate Process class

This commit is contained in:
Dylan K. Taylor
2019-03-24 18:57:32 +00:00
parent 1ea5316a37
commit 23071d257e
9 changed files with 193 additions and 149 deletions

View File

@ -29,10 +29,10 @@ namespace {
namespace pocketmine {
use pocketmine\utils\MainLogger;
use pocketmine\utils\Process;
use pocketmine\utils\ServerKiller;
use pocketmine\utils\Terminal;
use pocketmine\utils\Timezone;
use pocketmine\utils\Utils;
use pocketmine\utils\VersionString;
use pocketmine\wizard\SetupWizard;
@ -223,9 +223,9 @@ namespace pocketmine {
$gitHash = str_repeat("00", 20);
if(\Phar::running(true) === ""){
if(Utils::execute("git rev-parse HEAD", $out) === 0 and $out !== false and strlen($out = trim($out)) === 40){
if(Process::execute("git rev-parse HEAD", $out) === 0 and $out !== false and strlen($out = trim($out)) === 40){
$gitHash = trim($out);
if(Utils::execute("git diff --quiet") === 1 or Utils::execute("git diff --cached --quiet") === 1){ //Locally-modified
if(Process::execute("git diff --quiet") === 1 or Process::execute("git diff --cached --quiet") === 1){ //Locally-modified
$gitHash .= "-dirty";
}
}
@ -268,7 +268,7 @@ namespace pocketmine {
if(\pocketmine\DEBUG > 1){
echo "Some threads could not be stopped, performing a force-kill" . PHP_EOL . PHP_EOL;
}
Utils::kill(getmypid());
Process::kill(getmypid());
}
}while(false);