Module: Lich::Common::SagaManagedLauncher Private

Defined in:
documented/common/saga_managed_launcher.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Launches Saga through Saga's account/character auto-login intent. Saga remains responsible for authentication and for starting its Via-Lich child, so this path never creates or abandons a Lich-side game key.

Class Method Summary collapse

Class Method Details

.launch(account:, character:, game_code:, plan_builder: FrontendLauncher, process_launcher: method(:spawn_detached)) ⇒ Hash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Launches one Saga-managed Via-Lich session.

Invalid identifiers raise immediately. Expected machine-local failures (Saga unavailable or process spawn failure) return a structured failure for the GUI to report.

Parameters:

  • account (String)

    Saga account with a saved password

  • character (String)

    character to launch

  • game_code (String)

    Saga instance code

  • plan_builder (#saga_managed_login_plan) (defaults to: FrontendLauncher)

    injectable plan API

  • process_launcher (#call) (defaults to: method(:spawn_detached))

    callable accepting environment and argv

Returns:

  • (Hash)

    { ok: true, pid: Integer } or { ok: false, error: String }

Raises:

  • (ArgumentError)

    for invalid caller input



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'documented/common/saga_managed_launcher.rb', line 31

def launch(
  account:,
  character:,
  game_code:,
  plan_builder: FrontendLauncher,
  process_launcher: method(:spawn_detached)
)
  plan = plan_builder.(
    account: ,
    character: character,
    game_code: game_code
  )
  pid = process_launcher.call(plan.environment, plan.argv)
  { ok: true, pid: pid }
rescue FrontendLauncher::Error, SystemCallError => e
  { ok: false, error: e.message }
end