This commit is contained in:
2021-08-20 10:16:13 +08:00
parent 01ed2f1f48
commit 145f6e0bb6
+6 -4
View File
@@ -137,17 +137,19 @@ class ServerManager
private function initProcess($customProcess, $redirect_stdin_and_stdout, $pipe_type, $enable_coroutine): Process private function initProcess($customProcess, $redirect_stdin_and_stdout, $pipe_type, $enable_coroutine): Process
{ {
$server = $this->server; $server = $this->server;
return new Process( return new Process(function (Process $soloProcess) use ($customProcess, $server) {
function (Process $soloProcess) use ($customProcess, $server) {
if (is_string($customProcess)) { if (is_string($customProcess)) {
$customProcess = Kiri::createObject($customProcess, [$server]); $customProcess = Kiri::createObject($customProcess, [$server]);
} }
$name = $customProcess->getProcessName($soloProcess);
debug(sprintf("Process %s start.", $name));
$system = sprintf('%s.process[%d]', Config::get('id', 'system-service'), $soloProcess->pid); $system = sprintf('%s.process[%d]', Config::get('id', 'system-service'), $soloProcess->pid);
if (Kiri::getPlatform()->isLinux()) { if (Kiri::getPlatform()->isLinux()) {
$soloProcess->name($system . '.' . $customProcess->getProcessName($soloProcess) . ' start.'); $soloProcess->name($system . '.' . $name . ' start.');
} }
$customProcess->signListen($soloProcess); $customProcess->signListen($soloProcess);
echo sprintf("\033[36m[" . date('Y-m-d H:i:s') . "]\033[0m Process %s start.", $customProcess->getProcessName($soloProcess)) . PHP_EOL;
$customProcess->onHandler($soloProcess); $customProcess->onHandler($soloProcess);
}, },
$redirect_stdin_and_stdout, $redirect_stdin_and_stdout,