modify plugin name

This commit is contained in:
2022-02-28 17:42:28 +08:00
parent d9742f5579
commit e2a6ce6981
+14 -14
View File
@@ -100,7 +100,7 @@ class ProcessManager
*/ */
private function parse($customProcess, $system): Process private function parse($customProcess, $system): Process
{ {
return new Process(function (Process $process) use ($customProcess, $system) { return new Process(static function (Process $process) use ($customProcess, $system) {
if (Kiri::getPlatform()->isLinux()) { if (Kiri::getPlatform()->isLinux()) {
$process->name($system . '(' . $customProcess->getName() . ')'); $process->name($system . '(' . $customProcess->getName() . ')');
} }
@@ -108,19 +108,19 @@ class ProcessManager
Kiri::getDi()->get(EventDispatch::class)->dispatch(new OnProcessStart()); Kiri::getDi()->get(EventDispatch::class)->dispatch(new OnProcessStart());
set_env('environmental', Kiri::PROCESS); set_env('environmental', Kiri::PROCESS);
$channel = Coroutine::create(function () use ($process, $customProcess) { // $channel = Coroutine::create(function () use ($process, $customProcess) {
while (!$customProcess->isStop()) { // while (!$customProcess->isStop()) {
$message = $process->read(); // $message = $process->read();
if (!empty($message)) { // if (!empty($message)) {
$message = unserialize($message); // $message = unserialize($message);
} // }
if (is_null($message)) { // if (is_null($message)) {
continue; // continue;
} // }
$customProcess->onBroadcast($message); // $customProcess->onBroadcast($message);
} // }
}); // });
Context::setContext('waite:process:message', $channel); // Context::setContext('waite:process:message', $channel);
$customProcess->onSigterm()->process($process); $customProcess->onSigterm()->process($process);
}, },