diff --git a/src/tools/SteamTrainApp.php b/src/tools/SteamTrainApp.php index a5fb681..20725a1 100644 --- a/src/tools/SteamTrainApp.php +++ b/src/tools/SteamTrainApp.php @@ -11,7 +11,6 @@ class SteamTrainApp extends Application { const USE_LOGFILE = true; const USE_RUNFILE = true; const USE_RUNLOCK = true; - const USE_SIGNAL_HANDLER = true; const ARGS = [ "purpose" => self::TITLE, @@ -22,14 +21,17 @@ EOT, ["-c", "--count", "args" => 1, "help" => "spécifier le nombre d'étapes", ], - ["-s", "--use-signal-handler", "value" => true, + ["-s", "--install-signal-handler", "value" => true, "help" => "installer un gestionnaire de signaux", ], ]; protected $count = 100; + protected bool $installSignalHandler = false; + function main() { + if ($this->installSignalHandler) app2::install_signal_handler(); $count = intval($this->count); app2::action("Running train...", $count); for ($i = 1; $i <= $count; $i++) { diff --git a/wip/app/cli/Application.php b/wip/app/cli/Application.php index 2a875e0..6851ef7 100644 --- a/wip/app/cli/Application.php +++ b/wip/app/cli/Application.php @@ -80,7 +80,7 @@ abstract class Application { const USE_RUNLOCK = false; /** @var bool faut-il installer le gestionnaire de signaux? */ - const USE_SIGNAL_HANDLER = false; + const INSTALL_SIGNAL_HANDLER = false; static function _manage_runfile(int $argc, array $argv, RunFile $runfile): void { if ($argc <= 1 || $argv[1] !== "//") return; @@ -125,7 +125,7 @@ abstract class Application { } }; register_shutdown_function($shutdown); - app2::install_signal_handler(static::USE_SIGNAL_HANDLER); + app2::install_signal_handler(static::INSTALL_SIGNAL_HANDLER); try { static::_initialize_app(); $useRunfile = static::USE_RUNFILE;