modifs.mineures sans commentaires

This commit is contained in:
Jephté Clain 2024-09-29 16:22:57 +04:00
parent bd10883740
commit 137e7f2d2d
1 changed files with 21 additions and 3 deletions

View File

@ -83,22 +83,40 @@ abstract class Application {
/** @var bool faut-il installer le gestionnaire de signaux? */
const INSTALL_SIGNAL_HANDLER = false;
private static function _info(string $message, int $ec=0): int {
fwrite(STDERR, "INFO: $message\n");
return $ec;
}
private static function _error(string $message, int $ec=1): int {
fwrite(STDERR, "ERROR: $message\n");
return $ec;
}
static function _manage_runfile(int $argc, array $argv, RunFile $runfile): void {
static function _manage_runfile(int &$argc, array &$argv, RunFile $runfile): void {
if ($argc <= 1 || $argv[1] !== "//") return;
array_splice($argv, 1, 1);
array_splice($argv, 1, 1); $argc--;
$ec = 0;
switch ($argv[1] ?? "infos") {
case "help":
self::_info(<<<EOT
kill
release
infos
dump
reset
EOT);
break;
case "start":
case "s":
array_splice($argv, 1, 1); $argc--;
return;
case "kill":
case "k":
if ($runfile->isRunning()) $runfile->wfKill();
else $ec = self::_error("not running");
break;
case "release-lock":
case "release":
case "rl":
$runfile->release();