modifs.mineures sans commentaires
This commit is contained in:
parent
7d9039bcb1
commit
ee81057e44
|
@ -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 bool $dispach_signals = false;
|
||||||
|
|
||||||
static function install_signal_handler(bool $allow=true): void {
|
static function install_signal_handler(bool $allow=true): void {
|
||||||
if (!$allow) return;
|
if (!$allow) return;
|
||||||
$signalHandler = function(int $signo, $siginfo) {
|
$signalHandler = function(int $signo, $siginfo) {
|
||||||
throw new ExitError(255);
|
throw new ExitError(self::EC_SIGNAL);
|
||||||
};
|
};
|
||||||
pcntl_signal(SIGHUP, $signalHandler);
|
pcntl_signal(SIGHUP, $signalHandler);
|
||||||
pcntl_signal(SIGINT, $signalHandler);
|
pcntl_signal(SIGINT, $signalHandler);
|
||||||
|
|
|
@ -105,7 +105,7 @@ abstract class Application {
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fwrite(STDERR, "$argv[2]: unexpected command\n");
|
fwrite(STDERR, "$argv[2]: unexpected command\n");
|
||||||
$ec = 123;
|
$ec = app2::EC_BAD_COMMAND;
|
||||||
}
|
}
|
||||||
exit($ec);
|
exit($ec);
|
||||||
}
|
}
|
||||||
|
@ -132,7 +132,7 @@ abstract class Application {
|
||||||
$runfile = app2::get()->getRunfile();
|
$runfile = app2::get()->getRunfile();
|
||||||
|
|
||||||
self::_manage_runfile($runfile);
|
self::_manage_runfile($runfile);
|
||||||
if ($useRunlock && $runfile->warnIfLocked()) exit(1);
|
if ($useRunlock && $runfile->warnIfLocked()) exit(app2::EC_LOCKED);
|
||||||
|
|
||||||
$runfile->wfStart();
|
$runfile->wfStart();
|
||||||
$stop = true;
|
$stop = true;
|
||||||
|
@ -149,7 +149,7 @@ abstract class Application {
|
||||||
exit($e->getCode());
|
exit($e->getCode());
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
msg::error($e);
|
msg::error($e);
|
||||||
exit(1);
|
exit(app2::EC_EXCEPTION);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue