modifs.mineures sans commentaires

This commit is contained in:
Jephté Clain 2024-09-25 17:21:56 +04:00
parent 7d9039bcb1
commit ee81057e44
2 changed files with 11 additions and 4 deletions

View File

@ -476,12 +476,19 @@ class app2 {
#############################################################################
const EC_LOCKED = 252;
const EC_BAD_COMMAND = 253;
const EC_EXCEPTION = 254;
const EC_SIGNAL = 255;
#############################################################################
static bool $dispach_signals = false;
static function install_signal_handler(bool $allow=true): void {
if (!$allow) return;
$signalHandler = function(int $signo, $siginfo) {
throw new ExitError(255);
throw new ExitError(self::EC_SIGNAL);
};
pcntl_signal(SIGHUP, $signalHandler);
pcntl_signal(SIGINT, $signalHandler);

View File

@ -105,7 +105,7 @@ abstract class Application {
break;
default:
fwrite(STDERR, "$argv[2]: unexpected command\n");
$ec = 123;
$ec = app2::EC_BAD_COMMAND;
}
exit($ec);
}
@ -132,7 +132,7 @@ abstract class Application {
$runfile = app2::get()->getRunfile();
self::_manage_runfile($runfile);
if ($useRunlock && $runfile->warnIfLocked()) exit(1);
if ($useRunlock && $runfile->warnIfLocked()) exit(app2::EC_LOCKED);
$runfile->wfStart();
$stop = true;
@ -149,7 +149,7 @@ abstract class Application {
exit($e->getCode());
} catch (Exception $e) {
msg::error($e);
exit(1);
exit(app2::EC_EXCEPTION);
}
}