Module: Lich::Common::SessionLauncher
- Defined in:
- documented/common/session_launcher.rb
Overview
Launches independent child Lich sessions using prepared launch_data mapped to CLI-style argv.
Constant Summary collapse
- OPTIONAL_PATH_FLAGS =
Directory path overrides that child Lich processes may inherit or explicitly override.
Each entry maps a CLI option name (--home, --data, etc.) to a launch context key and a constants.rb constant name. The :inherit flag marks entries with no default constant in constants.rb; children spawned without such a flag cannot re-derive it, so the parent must explicitly pass it to maintain shared state (e.g., --active-session-dir).
[ { option: 'home', key: :home_dir, constant: :LICH_DIR }, { option: 'data', key: :data_dir, constant: :DATA_DIR }, { option: 'scripts', key: :script_dir, constant: :SCRIPT_DIR }, { option: 'temp', key: :temp_dir, constant: :TEMP_DIR }, { option: 'maps', key: :map_dir, constant: :MAP_DIR }, { option: 'logs', key: :log_dir, constant: :LOG_DIR }, { option: 'backup', key: :backup_dir, constant: :BACKUP_DIR }, { option: 'lib', key: :lib_dir, constant: :LIB_DIR }, # :inherit marks a flag with no constants.rb default of its own, which a # child therefore cannot re-derive from its own ARGV. Such a flag falls # back to this process's constant when the launch context omits it. { option: 'active-session-dir', key: :active_session_dir, constant: :ACTIVE_SESSION_DIR, inherit: true } ].freeze
Class Method Summary collapse
-
.launch(launch_data, launch_context: nil) ⇒ Hash
Launches a detached child Lich process from prebuilt launch data.
Class Method Details
.launch(launch_data, launch_context: nil) ⇒ Hash
Launches a detached child Lich process from prebuilt launch data.
49 50 51 52 53 54 55 56 57 58 |
# File 'documented/common/session_launcher.rb', line 49 def launch(launch_data, launch_context: nil) unless launch_data.is_a?(Array) && launch_data.any? return { ok: false, error: 'launch_data must be a non-empty Array' } end pid = spawn_process(launch_data, launch_context: launch_context) { ok: true, pid: pid } rescue StandardError => e { ok: false, error: e. } end |