Browse Source

update: variable-length argument lists

master
Dnomd343 2 years ago
parent
commit
c8f3448c60
  1. 12
      src/Daemon.php

12
src/Daemon.php

@ -46,16 +46,14 @@ function daemon(array $info): void {
} }
} }
function subExit(array $nginx, array $phpFpm, array $vlmcsd): void { function subExit(array ...$subList): void {
foreach ($subList as $sub) {
foreach (array($nginx, $phpFpm, $vlmcsd) as $subFunc) { $subName = $sub['name'];
$subName = $subFunc['name']; $subPid = getPid($sub['pidFile']);
$subPid = getPid($subFunc['pidFile']);
logging::info("Sending kill signal to $subName (PID = $subPid)"); logging::info("Sending kill signal to $subName (PID = $subPid)");
posix_kill($subPid, SIGTERM); posix_kill($subPid, SIGTERM);
} }
logging::info('Waiting sub-process exit...');
logging::info('Waiting sub process exit...');
pcntl_wait($status); // wait all process exit pcntl_wait($status); // wait all process exit
logging::info('All process exit, Goodbye!'); logging::info('All process exit, Goodbye!');
} }

Loading…
Cancel
Save